I have written a rule to add a custom claim when retrieving the access token.
The rule gets the claims from an external source and appends as below.
const namespace = 'https://myidserver.auth0.com/'; context.accessToken[namespace + 'claims'] = JSON.stringify(response.data);
Registered an api resource named myAPI.
I am getting the access token from a SPA application. Below are the options given for getting the token.
domain='https://myidserver.auth0.com/' client_id='client_id' audience="audience_uri" redirect_uri='redirect_uri' responseType="token id_token" scope="openid name profile https://myidserver.auth0.com/claims"
I am getting the access token from the application using getTokenSilently() method. But my access token has only the default claims. My custom claim is not added.
When the login workflow is called from the application, I can see my console log about adding the claims to the context object from the rule in the logger extension. I also tested the rule manually and everything is good.
Appreciate any inputs to solve this problem. Thanks in advance.