简体   繁体   中英

Is there a way to authenticate users in an ASP.NET Core MVC web app using Azure AD, but with a your own login page, not using Microsoft’s login portal

I'm trying to make my own login page for an ASP.NET Core MVC web app using Azure AD (not Azure AD B2C). But I can't find a good way to authenticate a user without using Microsoft's own login page. I don't want to use that.

So is there a way I can authenticate the username and the password, and get a boolean in return? The ASP.NET Core MVC web app uses C#.

The use of email and password is officially allowed to log in, but it's not recommended. For safety reasons, please evaluate your own after use.

You can read official doc first . And from the http request details, we can find it support username and password to log in.

// Line breaks and spaces are for legibility only.  This is a public client, so no secret is required.

POST {tenant}/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&scope=user.read%20openid%20profile%20offline_access
&username=MyUsername@myTenant.com
&password=SuperS3cret
&grant_type=password

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