Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if an email address is a Microsoft 'Work or School' account or a Microsoft Account

I would like to authenticate against both Microsoft accounts and 'Work or School' accounts in a Azure multi-tenant environment. Each authentication type requires different requests. If I try to login as a Microsoft account against the 'work or school' request the login will fail at the Microsoft login and not return to my application.

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

like image 682
John Ruf Avatar asked Sep 26 '22 08:09

John Ruf


2 Answers

If you use the REST api, it should automatically handle the two types of accounts.

However, it is in preview and might have restrictions or issues.

Here is a guide for using the REST api: http://graph.microsoft.io/en-us/docs/platform/rest

But be sure to check if that is acceptable to work with given the restrictions: https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-limitations/

like image 154
Tobiah Zarlez Avatar answered Oct 23 '22 14:10

Tobiah Zarlez


Microsoft released a converged Azure AD v2 of the authentication model. This blog post explains how to register your app to be able to use it. It will allow you to authenticate against both Work or School Account and Microsoft account.

Also, there is a YouTube tutorial here.

like image 21
Miro J. Avatar answered Oct 23 '22 13:10

Miro J.