Configure OAuth Apps in Identity Providers for External OAuth Integrations¶
Alation Cloud Service Applies to Alation Cloud Service instances of Alation
This topic provides a step-by-step process for setting up an OAuth application in different identity providers, such as Entra ID, Auth0, and Okta, for an external OAuth integration:
Manage Tokens in Microsoft Entra ID¶
Create an App Registration¶
First, you need to create an identity for your application.
Log in to the Microsoft Entra admin center.
Navigate to Identity(Microsoft Entra ID) > Manage > Applications > App registrations > New registration.
Name: Enter a descriptive name.
Supported account types: Select Accounts in this organizational directory only (Single tenant) unless you need multi-tenant support.
Redirect URI: Select Web and enter your application’s callback URL (for example,
https://localhost:5001/signin-oidc).Note
This is required for the Authorization Code flow.
Click Register.
Expose an API & Define Scopes¶
To ensure the token has your specific audience (aud), you must expose an API:
In your app registration, go to Expose an API.
Click Add next to Application ID URI. It usually defaults to
api://<client-id>. You can leave it or give it a friendly name. This URI becomes youraudvalue.Click Add a scope:
Scope name:
alation_access:role_anyWho can consent: Admins and users.
Admin consent display name: Access the API as a user.
State: Enabled.
Click Add scope.
Configure Grant Flows¶
Client Credentials Flow (Machine-to-Machine)¶
Go to Certificates & secrets.
Select New client secret, add a description, and set an expiration.
Copy the value immediately. You will not see it again.
Go to API permissions > Add a permission > APIs my organization uses.
Select your own app and choose Delegated permissions.
Select your scope and click Add permissions.
Click Grant admin consent for [Your Org]. (Without this, the client credentials flow will fail.)
Collect the Endpoint Information¶
Your application needs to know where to send requests to get tokens.
Go to the Overview page of your app registration.
Click on the Endpoints tab at the top.
You will see a drawer open with several URLs. You need:
OAuth 2.0 authorization endpoint (v2): For the Auth Code flow.
OAuth 2.0 token endpoint (v2): For both flows to exchange codes/secrets for tokens.
Example Curl Commands to Generate Tokens¶
Client Credentials Grant¶
curl --location 'https://login.microsoftonline.com/734e600a-8184-4d74-9548-b1dcf317f0ff/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: *****' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=api://aae36d60-fe54-4a9d-975c-17978a43a73f/.default'
Manage Tokens in Auth0¶
Create an Application¶
First, define the app that will perform the login:
Log in to the Auth0 Dashboard.
Go to Applications > Applications > Create Application.
Enter a descriptive Name.
Application Type: Select Regular Web Application. This allows for both Auth Code and Client Credentials flows.
Under the Settings tab:
Allowed Callback URLs: Enter your app’s redirect URI (for example,
https://localhost:5001/callback).Allowed Logout URLs: Enter your logout redirect (optional).
Scroll down and click Save Changes.
Record your Client ID and Client Secret, as you will need these for both flows.
Create and Expose the API¶
In Auth0, the audience (aud) is strictly tied to an API object.
Go to Applications > APIs > Create API.
Enter a name.
Identifier: Enter a unique URI (
https://<client_id>). Example:https://KF2SUq5h7a9DUoF7z4tsIQdYoYrdpLvD. This is youraudvalue.Click Create.
Go to the Permissions tab and define your scopes:
Permission (Scope):
alation_access:role_anyDescription: Access as any role.
Click Add.
To use refresh tokens, go to the Settings tab of this API and toggle Allow Offline Access to ON.
Configure Grant Flows¶
Client Credentials Flow (Machine-to-Machine)¶
Go to Applications > APIs and select your API.
Click the Machine to Machine Applications tab.
Find your app in the list and toggle the switch to Authorized.
Select the specific scopes (
alation_access:role_any) you want this app to have.Click Update.
Collect the Endpoint Information¶
Auth0 follows the OIDC standard for discovery.
Go to Applications > Applications and select your app.
Scroll to the bottom and click Advanced Settings.
Select the Endpoints tab.
OAuth Authorization Endpoint: For Auth Code flow.
OAuth Token Endpoint: For both flows.
OpenID Configuration:
https://<your_domain>/.well-known/openid-configuration. This JSON file lists every URL your app needs.
Adding a Custom Claim to the Token to Map the Username in Alation¶
Go to Actions > Library > Build Custom.
Enter a name, for example, Add Email to Access Token.
Trigger: Login / Post Login.
Paste this code into the editor.
Click Deploy.
Go to Actions > Triggers > Login/post-login.
Drag your new Add Email action into the flow diagram between Start and Complete.
Click Apply.
Important
In Auth0, custom claims in the access token must be name-spaced with a URI (for example, https://myapp.com/email) to prevent conflict with OIDC standard claims.
The namespace should be your identifier, for example: https://KF2SUq5h7a9DUoF7z4tsIQdYoYrdpLvD
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://my-api.example.com'; // Use your API Identifier
if (event.user.email)
{
api.accessToken.setCustomClaim(`${namespace}/email`, event.user.email);
}
};
Example Curl Commands to Generate Tokens¶
Client Credentials Grant¶
curl --location 'https://dev-r740qkog.us.auth0.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ****' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'audience=https://KF5SUq5h7a3DUoF7z9tsIQdYoYrdpLvD'
Authorization Code Grant After Generating the Code¶
The scope in the authorize request should be
openid profile email alation_access:role_any offline_accessThe authorize request should have the audience as one of the parameters
curl --location 'https://dev-r740qkog.us.auth0.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ****' \
--data-urlencode 'code_verifier=<code_verifier>' \
--data-urlencode 'code=<code>' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=https://oauthdebugger.com/debug'
Manage Tokens in Okta¶
Configuring Okta for both Authorization Code and Client Credentials flows is unique because, unlike Entra ID, Okta strongly separates “internal” org tokens from “API-facing” tokens using Custom Authorization Servers.
Create an Application¶
Log in to your Okta Admin Console.
Go to Applications > Applications > Create App Integration.
Select OIDC - OpenID Connect and Web Application. Click Next.
Grant type: Check both Authorization Code and Client Credentials.
Also check Refresh Token if you want to use
offline_access.
Sign-in redirect URIs: Enter your app’s callback (for example,
https://localhost:5001/callback).Assignments: Select Allow everyone in your organization to access for testing.
Click Save and copy your Client ID and Client Secret.
Configure Token Claims (Getting Email in the Token)(optional)¶
By default, Okta’s access tokens are slim. To add the user’s email:
In your Authorization Server, go to the Claims tab.
Click Add Claim.
Name: email.
Include in token type: Select Access Token.
Value type: Select Expression.
Value:
user.email.Include in: Select Any scope (or limit it to the email scope).
Click Create.
Define Access Policies (Crucial for Client Credentials)¶
Client Credentials flow in Okta will fail unless an Access Policy specifically allows it.
In your Authorization Server, go to the Access Policies tab.
Click Add Policy (for example, M2M Policy) and assign it to All Clients.
Click Add Rule under that policy:
Rule Name: Allow Client Credentials.
IF Grant type is: Check Client Credentials.
AND Scopes requested: Select Any scopes or your specific custom scope.
Click Create Rule.
Collect the Endpoint Information¶
In Security > API, click on your Authorization Server.
Go to the Settings tab.
Copy the Metadata URI.
It looks like:
https://{yourOktaDomain}/oauth2/{authServerId}/.well-known/oauth-authorization-server
Open that URL in your browser to find the
token_endpointandauthorization_endpoint.
Example Curl Commands to Generate Tokens¶
Client Credentials Grant¶
curl --location 'https://integrator-5651799.okta.com/oauth2/auszbh8wouJpEl3Xp697/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ****' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=alation_access:role_any'
Authorization Code Grant After Generating the Code¶
The scope in the authorize request should be openid email alation_access:role_any offline_access.
curl --location 'https://integrator-5651799.okta.com/oauth2/auszbh8wouJpEl3Xp697/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: ****' \
--data-urlencode 'code_verifier=<code>' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=https://oauthdebugger.com/debug' \
--data-urlencode 'code=<code>'