OAuth Server
Learn how to configure the Authorization Server in AuthN to manage access to your APIs
You can use AuthN's OAuth 2 Authorization Server (AS) to define and manage access to your online resources, such as services and APIs. During authorization flows, a client application requests an access token from the AS. Permissions associated with the access token can be expressed via its scope . The client application can then use the access token to authorize requests to your Resource Server (RS).
Token values can be either an opaque string or a signed JSON Web Token (JWT). You can choose the type of active tokens in your Pangea project in AuthN Session Configuration within the General section in the Pangea User Console. The RS can introspect an opaque access token to verify its issuer, audience, scopes, expiration, and other details, or read it from the signed JWT before granting access to a protected resource.
To set up the OAuth Server, Enable AuthN and navigate to the OAuth Server settings page in the Pangea User Console.
Audience
You can specify the intended audience for the access tokens issued by the AS. A list of the audience values you defined will be included in the token introspection results.
For example, an access token audience may contain an identifier of the RS or an API. In this case, permissions associated with the access token only apply at the RS or API matching the audience value. If there is no match, it may indicate a misrouting issue or a malicious access attempt, and access should be denied.
To manage audience values, click the pencil button next to the Audience label. In the edit dialog, type in an audience identifier and click Add to add a new value. Click the x button next to an existing audience value to remove it. Click Save to apply your changes.
You can also update the name of your OAuth Server in this dialog.

Configuration Details
In the Configuration Details section, you can find reference to the OAuth Server endpoints and copy them by clicking the corresponding tiles:
- Authorization Endpoint - Use this endpoint to start the Authorization Code grant .
- Token Endpoint - Use this endpoint to exchange an authorization code during the Authorization Code grant or client credentials during the Client Credentials grant for an access token.
- Metadata Endpoint - Use this endpoint to obtain Authorization Server Metadata in JSON format.
Clients
If you plan to support granular access to your services and APIs, you might want to start by setting up custom scopes on the Scopes tab.
Click the Clients tab to display existing OAuth 2 client registrations. To register a new client app, click the + OAuth Client button on the right.
In the Create OAuth Client dialog, use the following inputs to provide details about your client:
- Name - Assign a recognizable name to your client as it will appear in the list of clients in the OAuth Server settings. You can update this name at any time.
- Grant Types - Select the grant types your client application will use. Currently, only the Client Credentials grant is supported, but the Authorization Code grant with OpenID Connect (OIDC) extension will become available soon.
- Client secret expires in - Specify the lifespan for the new client secret. After it expires, you must generate a new secret for your client application.
- Access token expires in - Specify the lifespan for access tokens issued by the AS to this client.
- Allowed Scopes - Place the cursor in the input, select a scope value, and add it using the + button. This will enable the OAuth Server to add the scope to the tokens it issues to the client application. You can manage available scope values on the Scopes screen.
- Default Scopes - The scope values you add to the client registration are automatically included in the default scope. This default scope is added to the access token when no specific scope is requested during the authorization flow. You can remove the default values by clicking the
x
button.Register OAuth Client in AuthN's OAuth Server - Click the Create client button.
- After registering the client, copy its secret from the Your OAuth Client Secret dialog by clicking on the Client Secret tile. Once you close the dialog, you will not be able to access the secret value again. However, you can add new secrets to the client later, with the option to copy them.
Copy Client Secret - Select a client record from the list to view and edit its Details. To access client-specific actions, click the triple-dot button in the client's row. This menu lets you delete the client registration or add a new client secret. You can also manage the client’s secrets on the Secrets tab.
OAuth Client Registration Details and Client-specific Actions
Create a New Client Secret
Scopes
Custom scopes
In OAuth 2 authorization flows, the optional scope parameter requests specific permissions to be included in a token. On the Scopes tab, you can add, modify, and delete custom scope values that your resource server recognizes.
To add a custom scope value, click the + Scope button on the right. In the Create Scope dialog, provide the new scope value details in the following fields:
-
Name - Define the scope value. This value will be included in the
scope
parameter during the authorization flow, and if granted, added to the access token's scope. -
Display Name - Provide a recognizable name that will appear in the Display Name column in the scopes list.
-
Description - Explain what this scope value represents. For example, describe the permissions granted with this scope value.
-
Consent Required - Check this option to require explicit user approval for adding this scope value to the access token. This setting applies only to the Authorization Code grant.

Predefined scopes
-
openid
When supported by the AS, the
openid
scope value extends the Authorization Code grant to include OpenID Connect (OIDC) authentication. By adding this value to thescope
parameter, the client application requests the user's identity information in the form of an ID Token from the AS.Additional OIDC-defined scope values can be used to request specific claims (that is, user information fields) to be included in the ID Token.
The OIDC scope values are provided by default on the Scopes page.
The predefined scopes apply only to the Authorization Code grant.
To edit a scope value, click a row in the list, and the scope value details will be displayed on the right. You can update all scope value properties except for its name. Click Save to apply your changes.
In the Clients section on the scope value details screen, you can see which client applications can request this scope to be added to the access tokens issued by the AS.
To delete a custom scope, click the triple-dot menu in the selected scope's row.

Client credentials grant
Diagram
The OAuth Server supports the Client Credentials grant . Your client application can use this grant to exchange its client ID and secret for access tokens.