I am trying to create an API application that allows me to send JWTs to an Amazon Bedrock AgentCore Runtime services, which can decode JWTs via a clientID parameter, but it requires the JWT claims to have client_id explicitly. Since the JWT created by Auth0 only supplies azp, I cannot get this to work. I tried trigger actions, but learned that client_id is a reserved key and cannot be updated.
How can I resolve this issue?
Thanks!
Hi @shafkevi,
Welcome to the Auth0 Community!
You are asking how to make Auth0 access tokens for your API include an explicit client_id claim, because Amazon Bedrock AgentCore Runtime requires that claim and Auth0 tokens currently include only azp.
Switching the API’s Access Token Profile to RFC 9068 causes Auth0 to issue access tokens with client_id in place of azp. Custom Actions cannot set client_id because it is a reserved claim, so the profile change is the supported way to get this claim.
[Solution]
Option 1: Switching to the IETF RFC 9068 Token Profile (Recommended)
The cleanest and most robust method is to switch your API’s Access Token Profile to the IETF JWT Profile (RFC 9068) [911061]. When this profile is active, Auth0 automatically emits the standard client_id claim in the JWT payload instead of the legacy azp (Authorized Party) claim.
How to configure it:
-
Navigate to the Auth0 Dashboard > Applications > APIs.
-
Select your registered API (Resource Server) [911061].
-
Under the Settings tab, scroll down to Access Token Settings.
-
Find the Access Token Profile dropdown and change it from Auth0 to RFC 9068.
-
Click Save [911061].
Option 2: Appending a Custom Claim via Post-Login Actions (With Caveats)
You are entirely correct: client_id is a reserved OIDC/OAuth2 claim.
Auth0 strictly forbids adding, overwriting, or modifying core reserved claims (like client_id, sub, aud, iss, or scope) directly under their un-namespaced keys using custom claims . Attempting to do so will result in runtime errors or the claims being silently ignored.
However, you can successfully use an Auth0 Post-Login Action if you append the client ID under a custom namespace. This is a valid alternative if your downstream consumer (such as Amazon Bedrock AgentCore Runtime) can be configured to read a custom claim path.
Implementation:
Create and deploy a Post-Login Action using the following format:
exports.onExecutePostLogin = async (event, api) => {
// Replace with your custom domain or platform namespace
const namespace = 'https://api.yourdomain.com/claims';
// Sourcing the client ID dynamically from the event context
const clientID = event.client.client_id;
// Setting the claim securely under your custom namespace
api.accessToken.setCustomClaim(`${namespace}/client_id`, clientID);
};
I hope this helps and if you have further questions please let me know.
Thank you!
Best regards,
Remus