0
votes

Currently, I am using the Microsoft OneNote API (REST) to read the content of OneNote Pages. I have already subscribed for the notifications on the event of any changes happens in any page's content. Microsoft so sends me a notification for every change in the content of any page. They send a combination ofX-Authenticated user_id and subscription ID in the webhook. Like this:

{
  "value": [
    {
      "subscriptionId": "WLID-00000000441A2E0C",
      "userId": "WLID-1F50AB22CBE04E58"
    }
  ]
}

Recently, MS released the Graph API and recommended to use this one instead of the OneNote API. SO, I am migrating my implementation from OneNote API to Graph API.

I was getting userId (WLID-1F50AB22CBE04E58) with X-Authenticated-userId in the headers of the response of one of this API in OneNote API

https://www.onenote.com/api/v1.0/me/notes/notebooks

But, I am not getting this with Microsoft Graph. There should be a unique identity for each user who is completing the Authentication process.

Where will I get userId from Microsoft Graph?

1

1 Answers

0
votes

Authentication isn't handled by Microsoft Graph, it's handled by Azure Active Directory. You can get additional user information using OpenID Connect by requesting the scopes openid, email, and profile.

You can also get the current user's profile by calling the /me endpoint (https://graph.microsoft.com/v1.0/me).

Webhook Subscriptions also return a creatorId which will be the id for the authenticated user that created the subscription.