question

Dog2puppy avatar image
0 Votes"
Dog2puppy asked ·

How can I retrieve details on an authenticated user?

I'm new to Azure. I recently started a new project using Web Template Studio using Node.js on the backend hosted on Azure App Service. I have figured out how to require authentication using OAuth with Azure App Service, but I'm not sure how exactly I can get details on the user such as their name, email, or domain. I am using Google for my OAuth login. I was able to find this, but I'm not sure how to use it. Thanks in advance!


azure-webappsazure-webapps-securityazure-webapps-authentication
10 |1000 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.

xequence avatar image
0 Votes"
xequence answered ·

I would use this url to find your users account information, https://portal.azure.com/#blade/Microsoft_AAD_IAM/UsersManagementMenuBlade/AllUsers

If you are looking for code in the application to check claims then that is a different answer.

·
10 |1000 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.

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered ·

Hi Dog2puppy,

Welcome to Microsoft Q&A! Thanks for posting this question.

For all language frameworks, App Service makes the user's claims available to your code by injecting them into the request headers. External requests aren't allowed to set these headers, so they are present only if set by App Service. Some example headers include:

X-MS-CLIENT-PRINCIPAL-NAME

X-MS-CLIENT-PRINCIPAL-ID

From your client code (such as a mobile app or in-browser JavaScript), send an HTTP GET request to /.auth/me. The returned JSON has the provider-specific tokens.

By default, the claim which is obtained from Google provider doesn’t contain the users email address. You can try following the steps in this blog to configure your app to retrieve users email address.

Hope that helps.

-Grace


·
10 |1000 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.