question

StuartDawson-4077 avatar image
1 Vote"
StuartDawson-4077 asked mehdiICHKARRANE-6441 commented

How to access user claims in an Azure Static Web App?

As per the documentation here, you can access either the user name or email address once a user is authenticated but how can you access the other claims of the user, either client side or in the Azure Functions?



azure-ad-authenticationazure-static-web-apps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered mehdiICHKARRANE-6441 commented

Apologize for late response and inconvenience with this issue. Thanks for reaching here.

We currently don't have a way for the customer to access the user's claims other than the necessary ones such as id and email/name.

Could you please elaborate on the use cases in which having the full list of claims could be useful so that I reach out to PG on this.

Also, The best way to share your feedback would be to create a User Voice feedback item and upvote it. The product group monitors this site for feedback. This is the best way to ensure you are heard and you may receive a response depending on how much they information they can currently share.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi there, I would love to get an answer to this question, too.
In terms of the scenario, in my SWA, the user management is done via AzAD B2C. I capture details such as company name and so on, I would love to use this to store it in other places of my app, so that it can then be displayed in the user/company profile.

0 Votes 0 ·

Hi @SnehaAgrawal-MSFT. Thank you for the response.All I need is the username (as opposed to the name, which Auth0 just sets to the user's email address) of the user. Thanks.

P.S. I have created a user voice feedback item here: https://feedback.azure.com/forums/169385-web-apps/suggestions/43677366-username-exposed-to-azure-static-web-apps

0 Votes 0 ·

we would also like to be able to access other claims, we could make another call from our backend code but I feel in the serverless world that would not be ideal.

We are looking to read the users group membership for AAD authentication.

0 Votes 0 ·

Hello, it looks like this issue is still not resolved. This is a basic feature and most of our apps need to access the claims. The claims are visible in the .auth/me endpoint but are not accessible from the 'x-ms-client-principal' header, than looks more like a bug than a feature.

0 Votes 0 ·