Sign in

Type: MonoCloudOptions

Configuration options used to initialize the SDK client.

Configuration Sources

Configuration values can be provided using either:

  • Constructor options - passed when creating the client instance.
  • Environment variables - using MONOCLOUD_AUTH_* variables.

When both are provided, constructor options override environment variables.

Environment Variables

Core Configuration (Required)

Environment VariableDescription
MONOCLOUD_AUTH_CLIENT_IDUnique identifier for your application/client.
MONOCLOUD_AUTH_CLIENT_SECRETApplication/client secret used for authentication.
MONOCLOUD_AUTH_TENANT_DOMAINThe domain of your MonoCloud tenant (for example, https://your-tenant.us.monocloud.com).
MONOCLOUD_AUTH_APP_URLThe base URL where your application is hosted.
MONOCLOUD_AUTH_COOKIE_SECRETA long, random string used to encrypt and sign session cookies.

Authentication & Security

Environment VariableDescription
MONOCLOUD_AUTH_SCOPESSpace-separated list of OIDC scopes to request (for example, openid profile email).
MONOCLOUD_AUTH_RESOURCEDefault resource (audience) identifier used when issuing access tokens.
MONOCLOUD_AUTH_USE_PAREnables Pushed Authorization Requests (PAR) for authorization flows.
MONOCLOUD_AUTH_CLOCK_SKEWAllowed clock drift (in seconds) when validating token timestamps.
MONOCLOUD_AUTH_FEDERATED_SIGNOUTIf true, signing out of the application also signs the user out of MonoCloud (SSO sign-out).
MONOCLOUD_AUTH_RESPONSE_TIMEOUTMaximum time (in milliseconds) to wait for responses from the authentication service.
MONOCLOUD_AUTH_ALLOW_QUERY_PARAM_OVERRIDESAllows authorization parameters (such as scope, resource, or prompt) to be overridden via URL query parameters.
MONOCLOUD_AUTH_POST_LOGOUT_REDIRECT_URIURL users are redirected to after a successful logout.
MONOCLOUD_AUTH_USER_INFODetermines whether user profile data is fetched from the UserInfo endpoint after authorization.
MONOCLOUD_AUTH_REFETCH_USER_INFOIf true, user information is re-fetched on each userinfo request.
MONOCLOUD_AUTH_ID_TOKEN_SIGNING_ALGExpected signing algorithm for ID tokens (for example, RS256).
MONOCLOUD_AUTH_FILTERED_ID_TOKEN_CLAIMSSpace-separated list of ID token claims excluded from the session object.

Routes

Environment VariableDescription
MONOCLOUD_AUTH_CALLBACK_URLApplication path where the authorization server redirects the user after authentication.
MONOCLOUD_AUTH_SIGNIN_URLInternal route used to initiate the sign-in flow.
MONOCLOUD_AUTH_SIGNOUT_URLInternal route used to initiate the sign-out flow.
MONOCLOUD_AUTH_USER_INFO_URLRoute that exposes the authenticated user’s profile retrieved from the UserInfo endpoint.
Environment VariableDescription
MONOCLOUD_AUTH_SESSION_COOKIE_NAMEName of the cookie used to store the authenticated user session.
MONOCLOUD_AUTH_SESSION_COOKIE_PATHPath scope for which the session cookie is valid.
MONOCLOUD_AUTH_SESSION_COOKIE_DOMAINDomain scope for which the session cookie is valid.
MONOCLOUD_AUTH_SESSION_COOKIE_HTTP_ONLYPrevents client-side scripts from accessing the session cookie.
MONOCLOUD_AUTH_SESSION_COOKIE_SECUREEnsures the session cookie is only sent over HTTPS connections.
MONOCLOUD_AUTH_SESSION_COOKIE_SAME_SITESameSite policy applied to the session cookie (lax, strict, or none).
MONOCLOUD_AUTH_SESSION_COOKIE_PERSISTENTDetermines whether the session cookie persists across browser restarts.
MONOCLOUD_AUTH_SESSION_SLIDINGEnables sliding session expiration instead of absolute expiration.
MONOCLOUD_AUTH_SESSION_DURATIONSession lifetime in seconds.
MONOCLOUD_AUTH_SESSION_MAX_DURATIONMaximum allowed lifetime of a sliding session in seconds.
Environment VariableDescription
MONOCLOUD_AUTH_STATE_COOKIE_NAMEName of the cookie used to store OpenID Connect state and nonce values during authentication.
MONOCLOUD_AUTH_STATE_COOKIE_PATHPath scope for which the state cookie is valid.
MONOCLOUD_AUTH_STATE_COOKIE_DOMAINDomain scope for which the state cookie is valid.
MONOCLOUD_AUTH_STATE_COOKIE_SECUREEnsures the state cookie is only sent over HTTPS connections.
MONOCLOUD_AUTH_STATE_COOKIE_SAME_SITESameSite policy applied to the state cookie (lax, strict, or none).
MONOCLOUD_AUTH_STATE_COOKIE_PERSISTENTDetermines whether the state cookie persists beyond the current browser session.

Caching

Environment VariableDescription
MONOCLOUD_AUTH_JWKS_CACHE_DURATIONDuration (in seconds) to cache the JSON Web Key Set (JWKS) used to verify tokens.
MONOCLOUD_AUTH_METADATA_CACHE_DURATIONDuration (in seconds) to cache the OpenID Connect discovery metadata.

Extends

Properties

PropertyTypeDescription
allowQueryParamOverrides?booleanAllows authorization parameters to be overridden using query parameters. When disabled, parameters such as scope, resource, prompt, and login_hint present in the request URL are ignored and cannot modify the authentication request.
appUrl?stringBase URL where the application is hosted. Used to construct redirect URLs and validate requests.
clientId?stringClient identifier of the application registered in MonoCloud.
clientSecret?stringOptional client secret used for confidential clients.
clockSkew?numberAllowed clock skew (in seconds) when validating token timestamps.
cookieSecret?stringSecret used to encrypt and sign authentication cookies. This value should be long, random, and kept private.
debugger?stringIdentifier used for internal debugging/logging.
defaultAuthParams?AuthorizationParamsDefault authorization parameters automatically included in authentication requests unless explicitly overridden.
federatedSignOut?booleanWhen true, signing out also logs the user out of MonoCloud (Single Sign-Out).
filteredIdTokenClaims?string[]List of ID token claims that should be removed before storing data in the session.
idTokenSigningAlg?SecurityAlgorithmsExpected signing algorithm for ID tokens.
jwksCacheDuration?numberDuration (in seconds) to cache the JWKS document.
metadataCacheDuration?numberDuration (in seconds) to cache OpenID discovery metadata.
onBackChannelLogout?OnBackChannelLogoutInvoked when a back-channel logout request is received.
onSessionCreating?OnSessionCreatingInvoked before a session is created or updated. Can be used to modify session data or attach custom fields.
onSetApplicationState?OnSetApplicationStateInvoked before authentication begins to attach custom application state.
postLogoutRedirectUri?stringURL to redirect users to after logout completes.
refetchUserInfo?booleanRefetch user profile data whenever the application's UserInfo endpoint is invoked.
resources?Indicator[]Optional resource indicators available when requesting tokens via getTokens().
responseTimeout?numberMaximum time (in milliseconds) to wait for responses from the MonoCloud authorization server.
routes?Partial<MonoCloudRoutes>Overrides for built-in authentication route paths.
session?MonoCloudSessionOptionsSession configuration overrides.
state?MonoCloudStatePartialOptionsConfiguration for authentication state handling.
tenantDomain?stringMonoCloud tenant domain (for example, https://your-tenant.us.monocloud.com).
usePar?booleanEnables Pushed Authorization Requests (PAR). When enabled, authorization parameters are sent securely via the PAR endpoint instead of the browser.
userAgent?stringCustom User-Agent value sent with requests to MonoCloud.
userInfo?booleanFetch user profile data from the UserInfo endpoint after authentication completes.
© 2024 MonoCloud. All rights reserved.