Auth0 by Okta
Auth0 can be configured as an identity provider for accessing AgentCore Gateway and Runtime, or an AgentCore Identity credential provider for outbound resource access. This allows your agents to authenticate and authorize agent users with Auth0 as the identity provider and authorization server, or your agents to obtain credentials to access resources authorized by Auth0.
Inbound
To add Auth0 as an identity provider and authorization server for accessing AgentCore Gateway and Runtime, you must:
-
Configure discovery URL from your IDP directory. This helps AgentCore Identity get the metadata related to your OAuth authorization server and token verification keys.
-
Enter valid
audclaims for the token. This helps validate the tokens coming from your IDP and allows access for tokens that contain expected claims.
Use the following procedure to set up Auth0 and obtain the necessary configuration values for Gateway authentication.
To configure Auth0 for inbound authentication
-
Create an API in Auth0:
-
Sign in to your Auth0 dashboard.
-
Open APIs and choose Create API.
-
Enter a name and identifier for your API (e.g., "gateway-api").
-
Select the signing algorithm (RS256 recommended).
-
Choose Create.
-
-
Configure API scopes:
-
In the API settings, go to the Scopes tab.
-
Add scopes such as "invoke:gateway" and "read:gateway".
-
-
Create an application:
-
Open Applications and choose Create Application.
-
Select Machine to Machine Application.
-
Select the API you created in step 1.
-
Authorize the application for the scopes you created.
-
Choose Create.
-
-
Record the client ID and client secret from the application settings. You’ll need these values to configure the Auth0 provider in AgentCore Identity.
-
Construct the discovery URL for your Auth0 tenant:
https://your-domain/.well-known/openid-configurationWhere
your-domainis your Auth0 tenant domain (e.g., "dev-example.us.auth0.com"). -
Configure Inbound Auth with the following values:
-
Discovery URL : The URL constructed in the previous step
-
Allowed audiences : The API identifier you created in step 1
-
Outbound
Note
AgentCore Identity issues a unique OAuth2 callback URL for each credential provider you create. The unique callback URL enables session binding, which protects the OAuth2 authorization-code exchange against cross-provider replay and CSRF-style attacks by ensuring an authorization response can only be redeemed against the specific credential provider that initiated it. Because the URL is unique per provider, you won’t know it until after you call CreateOauth2CredentialProvider. Create your Auth0 application first, then return to the Auth0 dashboard to register the callback URL once AgentCore Identity has issued it.
Step 1: Create the Auth0 application
Use the following procedure to set up an Auth0 OAuth2 application and obtain the necessary client credentials for AgentCore Identity. You will register the redirect URI in Step 3, after AgentCore Identity issues the unique callback URL.
To configure an Auth0 OAuth2 application
-
Sign in to your Auth0 dashboard.
-
Open Applications and choose Create Application.
-
Enter a name for your application and select Regular Web Application as the application type.
-
Choose Create.
-
On the application’s Settings tab, leave Allowed Callback URLs empty for now — you will add the unique callback URL in Step 3.
-
Configure any connections, scopes, and permissions necessary for your application.
-
Record the Client ID and Client Secret from the application settings. You’ll need these values to configure the Auth0 provider in AgentCore Identity.
-
Note your Auth0 tenant domain (for example,
dev-example.us.auth0.com). You’ll use this to construct the authorization, token, and issuer endpoints in Step 2.
For more details, refer to Auth0’s documentation on creating applications
Step 2: Create the AgentCore Identity credential provider
To configure Auth0 as an outbound resource provider, use the following:
{ "name": "NAME", "credentialProviderVendor": "Auth0Oauth2", "oauth2ProviderConfigInput" : { "includedOauth2ProviderConfig": { "clientId": "your-client-id", "clientSecret": "your-client-secret", "authorizationEndpoint": "https://your-auth0-tenant.auth0.com/authorize", "tokenEndpoint": "https://your-auth0-tenant.auth0.com/oauth/token", "issuer": "https://your-auth0-tenant.auth0.com" } } }
The CreateOauth2CredentialProvider response includes a callbackUrl field. This URL is unique to this credential provider and looks like: https://bedrock-agentcore.us-east-1.amazonaws.com/identities/oauth2/callback/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. Save this value for the next step.
Step 3: Register the unique callback URL with Auth0
Return to the Auth0 dashboard and add the unique callback URL to your application’s allowed callbacks.
-
Sign in to your Auth0 dashboard and open the application you created in Step 1.
-
On the Settings tab, paste the
callbackUrlvalue returned byCreateOauth2CredentialProviderinto Allowed Callback URLs. -
Choose Save Changes.