简体   繁体   中英

Authenticate Office 365 and fetch user information and display in form using C#

In my ASP.NET MVC application login page, user will enter email address and password of Office 365 and user details should validate in Office 365 and redirect to my home page and in the home page form using email address which entered in login page has to fetch user information like firstname, lastname and mobilenumber which is configured in Office 365. Please guide me how to authenticate and fetch user information from Office 365

I am expecting how to achieve this both scenario without redirect to Office 365 page and required way to implement this in ASP.NET MVC.

Firstly - What you want to do is 100% possible. We had this working at my last place. The exact implementation is upto you.

The technology you need to use is Azure Active Directory. There is a good basic walk through here https://learn.microsoft.com/en-us/azure/active-directory/develop/web-app-quickstart?pivots=devlang-aspnet-core

The key points

  • You create an application in AAD that represents your app
  • With AAD you can control the access in a variety of ways, including down to groups or individuals
  • You get your app to trust the token provided by AAD
  • When your user comes to your app they are authenticated by being sent to AAD and return with a token specifically for your app
  • If they are already logged into M365 (which they will be most of the time) then they are not challenged, the page just refreshes a couple of times

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM