nam
nam

Reputation: 23859

MS Graph: How to determine the account type of logged in user?

Question: Is there a way to query if a given email address is a 'Work or School' account against the Microsoft graph API?

I would like to authenticate against both Microsoft accounts and 'Work or School' accounts in a Azure multi-tenant environment.

Upvotes: 2

Views: 835

Answers (1)

Allen Wu
Allen Wu

Reputation: 16458

Generally speaking, there is no a direct endpoint to query if this account is a work account or MSA.

Based on your description, you are using common authority to authenticate the user.

When you enter your username and password, the url in address bar will be:

https://login.microsoftonline.com/common/****** for work account

AND

https://account.live.com/Consent/****** for Microsoft accounts.

If you call https://graph.microsoft.com/v1.0/me, you will find that id of work account is like this "id": "987932c9-f062-48e2-8ced-22cb6896dfce" while id of an Microsoft account is like "id": "5d9ee9b4b2ad3bfe".

Upvotes: 2

Related Questions