How can I retrieve details on an authenticated user?

Rosalina 1 Reputation point
2019-12-20T01:07:55.64+00:00

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 App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,103 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. xequence 6 Reputation points
    2019-12-22T06:06:28.64+00:00

    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.

    0 comments No comments

  2. Grmacjon-MSFT 18,721 Reputation points
    2019-12-30T20:06:54.087+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.