Microsoft Graph Api-Unable to get logged in user details

Farhin S. Shaikh 21 Reputation points
2019-12-14T09:24:56.717+00:00

Hi, I am new to azure counting only on the ongoing project experience. To give a background about the issue that I am facing with Azure active directory is,I have to implement authentication/authorization for my application that will be hosted on Public cloud but will be accessible to users from a particular domain only(single tenant).

link text

Attachment includes code that I have written to get the logged in User details. when trying to run the application,below is the error that I am getting:

{ "error": { "code": "Request_ResourceNotFound", "message": "Resource '4420a373-e920-4294-b479-750d6a1845c5' does not exist or one of its queried reference-property objects are not present.", "innerError": { "request-id": "4ad3af1d-e063-4863-806c-6fc28ee8e0bc", "date": "2019-12-14T08:09:53" } } }

I have cross verified :

1- ClientId,SecretId,TenantId of my application given in the code

2- The token that I am getting through the code using jwt.io.

3- My User name is already there in the Azure Active directory as well.

4- Read User profile scope is granted to my account

When trying to access the api from Graph explorer using https://graph.microsoft.com/v1.0/me/ I am able to access my details.

But when trying to run this to code,I get below error.

Any help would be appreciated on this.

Regards.

Hi

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,083 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 98,196 Reputation points MVP
    2019-12-14T18:35:37.99+00:00

    You are obtaining a token via the confidential client flow, meaning you not running in the context of a user. Thus you should not be using the /me endpoint, but /users/objectID one.

    Or obtain a token via some of the delegate permissions flows.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful