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:
forRootAsync
Use forRootAsync when configuration comes from another provider, such as
ConfigService:
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).
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
endpoint | string | ✓ | — | Authgear project endpoint, e.g. https://my-project.authgear.cloud. Used for OIDC discovery and as the expected token aud/iss. |
clientID | string | — | If set, the verifier also asserts the token’s client_id claim equals this value. | |
global | boolean | false | Register AuthgearAuthGuard as a global APP_GUARD so every route is protected by default. | |
jwksCacheMaxAge | number | 300000 (5 min) | Max age, in milliseconds, before the cached JWKS is considered stale and refreshed. | |
clockToleranceSeconds | number | 0 | Leeway, in seconds, applied to exp/iat checks. |
Next steps
Last updated on