microsoftgraph / microsoftgraph/msgraph-metadata

Unable to call the m365 graph api, as access token is not valid ( also not in JWT format ) when login with personal microsoft accounts.

Open
#541 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ToTriage
Dominant language
XSLT
Stars
166
Forks
55
Avg merge
16h 12m
Merged PRs (30d)
14

Description

I'm using @azure/msal-node package for my node js backend for signing in users and getting an access token for calling the m365 graph api. It works for the user inside our tenant but not for personal microsoft accounts. In my Microsoft Entra ID manifest, I changed the signInAudience to: "signInAudience": "AzureADandPersonalMicrosoftAccount", and it logs in the user successfully with personal accounts as well, but the access token received is short as compared to the access token received for the tenant users. And also the token is not in JWT format, when I copy-paste in jwt.io or jwt.ms it has no user data. And all these things works in the graph explorer fine. And when I copy the access token from graph explorer and paste in our application or POSTMAN, it works, I don't know how. I want to allow all accounts with linked or associated with microsoft to login to my application. Thanks!

I tried changing the permissions in the Microsoft Entra ID but nothing works, the token received for microsoft personal accounts is not working. I've also changed the endpoint to /common. Before it was https://login.microsoftonline.com/TENANT_ID. Now, changing it to https://login.microsoftonline.com/common also it is not working, just signing in the user that's it. Unable to fetch logged in user data, unable to call the m365 graph api.

I'm calling the https://graph.microsoft.com/v1.0/me endpoint for fetching the logged in user profile/data. And after that I also want to fetch the Calendar Events ( CRUD ). I think issue is in receiving the code which we receive in the URL after successfull login. I mentioned it as "grant_type":"authorization_code"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the @azure/msal-node authorization-code flow and the Microsoft Entra ID signInAudience and /common endpoint settings described in the issue. Reproduce the personal-account login, inspect the returned access token, and compare its permissions with the Microsoft Graph Explorer token. Done means the token can call https://graph.microsoft.com/v1.0/me and support the intended calendar CRUD operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, node.js
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.