User5590
User5590

Reputation: 1435

Authenticate users with Office365 in MVC aplication

I am developing MVC based web application and want to authenticate every users with their own Office365 account. Once signed in successfully, it should provide the details of that user. The users are not specific to my organization only, they can be from any organization.

I have tried below link to achieve the same.

http://graph.microsoft.io/en-us/docs/platform/aspnetmvc

The above link has a very first step to register the application in the azure active directory, but if i will do that then it will only authenticate users from my organization. But in my case, every user has to be authenticated by their own organization.

So i want to know that is it possible? If yes, then how do i achieve that?

Upvotes: 1

Views: 1211

Answers (2)

Marc LaFleur
Marc LaFleur

Reputation: 33094

Registering you application in your Azure Active Directory does not preclude you from authenticating external users.

With OAUTH you have 3 actors; the Application, the Provider and the User. Each of these actors needs to trust the others. The connection between the Provider and the User is the User Account (i.e. User ID). The connection between the Provider and the Application is the Application Account (i.e. App ID).

When you register your application in Azure Active Directory you are simply establishing an Application ID. The only requirement for the User account is that it also lives within an Azure Active Directory. This does not however have to be the same AAD.

If this is a public facing website, you may want to use the newer v2 endpoint instead. Under the covers it is very similar to the workflow you've been looking at but the registration and permissions process is far more straightforward.

Upvotes: 1

Yina - MSFT
Yina - MSFT

Reputation: 1786

Yes, it is possible you need to enable multi-tenancy on your app. On the app configuration page in the Windows Azure Portal you will find the toggle for "Application is Multi-tenant". For more information about multi-tenant apps: https://azure.microsoft.com/en-us/documentation/articles/active-directory-authentication-scenarios/#application-types-and-scenarios

Upvotes: 0

Related Questions