Skip to main content
Cross App Access (XAA) allows IT admins in an enterprise setting to centrally manage app-to-app and agent-to-app connections. Token Vault works with XAA to securely store and reuse the access tokens your application retrieves from a third-party API on a user’s behalf. With Token Vault, your application can exchange an Auth0 refresh token for a stored third-party access token in a single call without requiring the user to go through an OAuth 2.0 consent flow. Instead, that access is mediated by a centralized identity provider (IdP) that is trusted by both your organization and the third-party API. To learn more about XAA in Auth0, read Cross App Access.
If you want to build and test the full XAA flow from the Requesting App side: Complete Environment Setup and Okta as OIDC IdP first, then return here to configure your test application.If you already have Token Vault set up and want to add XAA support: Skip to Add XAA to an existing Token Vault integration.

What’s different with XAA?

  1. When using Token Vault with XAA, end users do not need to connect their account with external applications. Your application does not need to provide a button to “Connect to [Third-party Application]” that makes a POST request to the My Account API’s /me/v1/connected-accounts/connect endpoint.
  2. The end user needs to authenticate using a federated login with an Okta or OIDC connection that is configured for XAA. That connection must be configured as a Requesting App.
  3. The third-party API being accessed must support XAA as a Resource App, meaning it can exchange an ID-JAG for access tokens.
  4. A connection to the third-party application must exist with Connected Accounts for Token Vault and Cross App Access for Token Vault enabled.

Add XAA to an existing Token Vault integration

If you already have Token Vault set up and want to add XAA support, you need to update two existing connections: the connection your users authenticate with (the Requesting App connection) and the connection to the third-party API (the Resource App connection).
This section covers only the Auth0-side changes needed to enable XAA on existing connections. If you are creating these connections for the first time, or need to configure the Okta side, follow Okta as OIDC IdP for the full end-to-end setup.

Configure the Requesting App connection

The connection your users authenticate with must be configured to request an ID-JAG from the enterprise IdP on the user’s behalf. This can be an Okta Workforce or OIDC connection.
  1. Navigate to Authentication > Enterprise, select your connection, and open its settings.
  2. Under Credentials, set Communication Channel to Back Channel. Token Vault cannot request an ID-JAG using the front channel.
  3. Under Settings > Scopes, add offline_access.
  4. Under Mappings, select Okta Basic and add offline_access to the userinfo_scope list in the JSON mapping. Select Save.
  5. Under Cross App Access > Cross App Access Role, select Requesting Application.
  1. Select Save.

Configure the Resource App connection

The Resource App connection to the third-party API must be an OIDC connection with both Connected Accounts for Token Vault and Cross App Access for Token Vault enabled.
  1. Navigate to Authentication > Enterprise, select the OIDC connection to the third-party API, and open its settings.
  2. Under Purpose, select Connected Accounts for Token Vault or Authentication and Connected Accounts for Token Vault.
  3. Under Cross App Access:
    • For Cross App Access Roles, enable Requesting Application.
    • Enable Cross App Access for Token Vault.
  1. Select Save.
Once you’ve configured both connections, proceed to Configure your test application and test the end-to-end flow.

Configure your test application

In your Requesting App tenant, create or configure the application that will perform the Token Vault token exchange.
Only confidential, first-party, OIDC-conformant clients can use the Token Vault grant type. Regular Web Applications meet these requirements.
Navigate to Applications > Applications and select Create Application. Enter a name and select Regular Web Application.
  1. Under Application URIs, add your application’s callback URL (e.g. https://localhost:3000/callback) to Allowed Callback URLs.
  2. Under Cross App Access, enable Allow Cross App Access.
  3. Under Advanced Settings > Grant Types, enable Authorization Code, Refresh Token, and Token Vault.
  4. Select Save Changes.
Note the Client ID and Client Secret of the application. You’ll need these when performing the token exchange.

Enable Okta connections for the application

If you set up the XAA test environment from the Requesting App side from scratch: You need to enable the OIDC connection you configured in the Environment Setup between your Requesting App tenant and Resource App tenant and the Okta Workforce connection you configured in Okta as OIDC IdP for this application. If you already have Token Vault set up and are adding XAA support: You need to enable the Requesting App connection and Resource App connection for the test application you just created. To learn more, read Add XAA to an existing Token Vault integration.
To enable the Okta Workforce connection or the Requesting App connection:
  1. Navigate to Authentication > Enterprise > Okta Workforce, select the Okta Workforce connection, and select the Applications tab. Then, enable it for the test application you just created.
To enable the OIDC connection or the Resource App connection:
  1. Navigate to Authentication > Enterprise > OpenID Connect (OIDC), select the OIDC connection, and select the Applications tab. Then, enable it for the test application you just created.

Test the end-to-end flow

To test the XAA Token Vault flow, your application must:
  1. Obtain an Auth0 refresh token by completing an authorization code flow with the Okta Workforce connection or the Requesting App connection.
  2. Exchange the refresh token for a Resource App access token with the OIDC connection using the Token Vault grant type or the Resource App connection.
Use the test application you configured in Configure your test application or an existing application with the Token Vault grant enabled.

Step 1: Obtain an Auth0 refresh token

Your application uses the authorization code flow with the Okta Workforce connection to authenticate the user and obtain a refresh token.

Initiate the authorization request

Send the following GET request to the Auth0 /authorize endpoint, substituting your own values:
Your test user will be redirected to Okta to authenticate. After a successful login, Auth0 redirects back to your redirect_uri with an authorization code in the query string.

Exchange the authorization code for a refresh token

Send a POST request to the Auth0 /oauth/token endpoint to exchange the authorization code for tokens:
A successful response includes a refresh_token:

Step 2: Exchange the refresh token with Token Vault

Use the refresh token to call the Token Vault grant type endpoint and retrieve a Resource App access token.
Token Vault uses the XAA flow to obtain an access token to the Resource App by looking for a stored refresh token from a valid Requesting App IdP, asking that IdP for an ID-JAG token on your behalf, and then presenting it to the Resource App in exchange for an access token, before returning the access token to your app. A successful response returns a Resource App access token:
Your application can now use this access token to call the Resource App’s API on the user’s behalf.

Handle multiple Requesting App IdPs

An Auth0 tenant might have many connections configured to IdPs that support XAA as a Requesting App, and which have XAA enabled (e.g. their cross_app_access_requesting_app.active property is set to true). When an application makes a token exchange request, Token Vault can only request an ID-JAG from an IdP that the user has already authenticated with. There must be exactly one valid user identity linked to the current user’s profile, where XAA is enabled on the connection authenticating the user, otherwise Token Vault will not know which IdP to request an ID-JAG from. If there are multiple valid identities, the request will fail with the following error:
If the current user profile has more than 10 linked identities on connection types that support XAA (i.e. Okta and OIDC connection types) even if those connections do not have XAA enabled Token Vault will fail with the error:
This limits the number of connections that Token Vault must check in order to locate a valid XAA connection.

Use Auth0 Organizations with XAA

Token Vault will also filter the available Requesting App connections by those that are enabled for the current user’s organization. An Auth0 solution that uses Organizations can limit access to each IdP by Organization in order to clarify which Requesting App connection should be used for each user session. Each subject_token that is used in a Token Vault exchange contains information about the organization that the user logged into. This organization context will be used to find the correct XAA Requesting App connection. However, if multiple valid connections are found, the request will still fail.