3
votes

I got the workaround to work to add claims to the token using a custom REST API, however I realized this is the Id token and not the Access token. I need the custom claims to be the Access token to use for authorization in the service.

I haven't inspected the Access token yet but are these claims also inserted into the Access token?

https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-custom-rest-api-netfw

3

3 Answers

2
votes

Yes, custom claims come back when requesting access tokens. The only difference in the list of claims is the scp claim. The scp claim is only returned on access tokens.

Unfortunately, the Claims in ID and access tokens documentation doesn't discuss this.


You can quickly verify this via the Run Now feature in the Azure Portal. See this SO answer.

Sample access token w/ a custom claim

sample access token w/ a custom claim

2
votes

I am using custom claims in my Azure Active Directory B2C tenant where I registered two applications (UI and API). The UI passes the access_token to the API and I am able to retrieve the custom claims there. I guess this should be also true for custom claims using a custom REST API.

If not, It must be possible to setup:

... The return claims can be stored in the user's Azure AD account, evaluated in the next Orchestration Steps, or included in the access token

0
votes

If your question is "Can I get the user's access token from the federating IdP such as Azure AD, facebook etc"? The answer currently is no. You can vote for this feature here.

https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/15334347-return-social-idp-s-native-access-tokens-back-to-t