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.
Note: unless you’re checking for this scope in the request within the rule, there’s no need to explicitly add this as additional scope. Is the custom claim always added to the token or only under certain conditions, i.e. when this specific scope is being requested?
Just wanting to rule out that there’s no if/else statement causing the logic to be skipped.
I am getting the access token from the application using getTokenSilently() method.
Rule code looks fine.
Maybe worth testing another grant type, i.e. an easy way would be via Postman and Resource Owner Password Grant (ROPG) to see if it makes a difference. I mean, just for testing, as it’s fairly easy to execute (otherwise not recommending ROPG ;).
Thanks. I tried with Auth. code grant and ROPC flows in Postman. I am not seeing the claim in both the flows. Below is the output (extracted only access/id tokens) of the rule execution from the test window. I can also see the console logs from the rule when i test the login from my SPA.