isAuthorizedSE is an optional service extension that can be used on its own or in addition to rules to determine if a user is authorized. When both rules and isAuthorizedSE are configured, a user will be authorized if both the rules and the isAuthorizedSE evaluate to true.
#### Token Minting
`tokenMinting` defines policies that govern the issuance of access tokens and ID tokens.
**Access Token**
`accessToken` defines the policies applicable to the issuance of access tokens.
**Policies**
`policies` define the list of OPA policies written using Rego. Multiple policies can be defined in order to support the layering of fine-grained authorization rules. Policies are evaluated based on priority order (the order they’re defined).
Access tokens are minted if any policy for the given app evaluates to true. Therefore, it is important to write policies that fail closed and only allow access if explicitly defined conditions are true.
For more info on how to define OPA policies, please see the OPA [docs](/v1/docs/opa-authorization).
### Access Token
`accessToken` defines the configuration for the OAuth access token.
#### Type
`type`can be set to either `jwt` (default) or `opaque`.
#### Length
`length` defines the length of an `opaque` access token. The length can set to between 22 and 256 characters. If unset, the default `length` is 28 characters.
#### Lifetime Seconds
`lifetimeSeconds` controls the lifetime of an access token. By default, access tokens have a lifetime of one hour.
### Refresh Token
`refreshToken` defines the configuration for the OAuth refresh token. Refresh tokens are used to get a new access token without user interaction.
Refresh tokens are automatically rotated with every access token refresh. That is, everytime a refresh token is used to generate a new access token, a new refresh token is also returned. If a previously issued refresh token is reused outside an acceptable window, the active refresh token will be invalidated.
Refresh tokens are rotated to protect against refresh token replay attacks and compromised long-lived refresh tokens. For more information, please reference the OAuth Security Topics [RFC](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-24#section-4.14.2).
#### Allow Offline Access
`allowOfflineAccess` defines whether a client can request refresh tokens. Refresh tokens will only be issued if the `allowOfflineAccess` flag is set to true and the authorization request includes the `offline_access` scope.
> [!NOTE]
> If `grantTypes` are defined, `refresh_token` must be specified for refresh tokens to be issued. See [Grant Types](/docs/oidc-local-development#grant-types) for more info.
#### Lifetime Seconds
`lifetimeSeconds` controls the lifetime of a refresh token. By default, refresh tokens have a lifetime of 24 hours.
#### Length
`length` can be set to between 22 and 256 characters to define the length of a refresh token. If unset, the default `length` is 28 characters.
### CORS
`cors` is an optional configuration that defines the CORS policy for the OIDC app.
#### Allowed Origins
`allowedOrigins` is a list of allowed origins that can make cross-origin requests to the OIDC provider. Browser clients will use this configuration to determine if the OIDC provider is allowed to respond to cross origin requests. The value of `allowedOrigins` must be a valid URL, such as `https://app.enterprise.com`.
> [!WARNING]
> For production environments, it is recommended to only use https URLs in the `allowedOrigins` list. Non-secure origins (http) can lead to security vulnerabilities, such as cross-site scripting (XSS) attacks.
#### Allowed Credentials
`allowedCredentials` is a boolean flag that controls whether the OIDC Provider includes the HTTP response header: `Access-Control-Allow-Credentials: true`.
When set to true, browsers are permitted to expose responses to requests that include credentials such as cookies, authorization headers, or TLS client certificates.
> [!WARNING]
> Enabling `allowedCredentials` broadens what data browsers will expose to client code. Only set it for trusted origins that you control.
### AllowedAudiences
`allowedAudiences` is an optional configuration that represents a list of audiences that are allowed to consume access tokens. When a client makes a request to the authorization endpoint, an optional `resource` parameter can be included that indicates the target audience of the token. The value provided in the `resource` parameter must be on the list of allowed audiences.
This configuration is used when resource servers, such as APIs, authorize via the access token. For more information, please reference [RFC 9068](https://datatracker.ietf.org/doc/html/rfc9068#section-3).
### BuildIDTokenClaims service extension
The `buildIDTokenClaimsSE` is an optional service extension that can customize how claims in the ID token are built. This service extension should be used when non-standard claims need to be added to the ID token.
### BuildAccessTokenClaims service extension
The `buildAccessTokenClaimsSE` is an optional service extension that can customize how claims in the access token are built. This service extension should be used when non-standard claims need to be added to the access token.
### Custom Scopes
`customScopes` is an optional config used to specify the list of non-standard OIDC scopes available to a client application.
#### Scopes
`scopes` are the a list of custom scopes that can be requested by the client application.
##### Name
`name` is the name of the custom scope, e.g. `read:user`.
## Examples
### Basic OIDC App Config Example
```yaml
apps:
- name: exampleOIDCApp
type: oidc
clientID: exampleClientID
credentials:
secrets:
-