Skip to Content
Getting StartedConfiguration

Configuration

Register AuthgearModule once in your root module. It is a global dynamic module, so AuthgearTokenService and AuthgearAuthGuard become available everywhere without re-importing.

forRoot

Use forRoot when your configuration is static:

app.module.ts

forRootAsync

Use forRootAsync when configuration comes from another provider, such as ConfigService:

app.module.ts
.env

Options reference

These options apply to both forRoot and the object returned by the forRootAsync factory (the global flag is set directly on the forRootAsync options object).

OptionTypeRequiredDefaultDescription
endpointstringAuthgear project endpoint, e.g. https://my-project.authgear.cloud. Used for OIDC discovery and as the expected token aud/iss.
clientIDstringIf set, the verifier also asserts the token’s client_id claim equals this value.
globalbooleanfalseRegister AuthgearAuthGuard as a global APP_GUARD so every route is protected by default.
jwksCacheMaxAgenumber300000 (5 min)Max age, in milliseconds, before the cached JWKS is considered stale and refreshed.
clockToleranceSecondsnumber0Leeway, in seconds, applied to exp/iat checks.

Next steps

Last updated on