How can I get the currently logged in user by Graph API

Jack Zhang 1 Reputation point
2021-03-05T09:34:02.397+00:00

How can I get the currently logged in user by Graph API

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Danstan Onyango 3,906 Reputation points Microsoft Employee
    2021-03-10T08:20:42.437+00:00

    Are you using Azure AD Graph or Microsoft Graph. Both of these have /me endpoints that you can use to get current signed in user. From your question it is not clear which Graph you are using. Please comment with more info. But the links attached have docs for getting current signed in user.

    1 person found this answer helpful.

  2. Khurram Rahim 1,851 Reputation points Volunteer Moderator
    2023-02-08T19:24:50.1033333+00:00

    You can retrieve the currently logged in user information using the Microsoft Graph API by sending a GET request to the following endpoint:

    bash

    Copy code

    https://graph.microsoft.com/v1.0/me

    You'll need to include an access token in the authorization header of the request, which you can obtain using the OAuth 2.0 authorization flow.

    Here's an example using cURL:

    css

    Copy code

    curl --location --request GET 'https://graph.microsoft.com/v1.0/me' \

    --header 'Authorization: Bearer <ACCESS_TOKEN>'

    Replace <ACCESS_TOKEN> with a valid access token.

    1 person found this answer helpful.

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.