简体   繁体   English

Azure B2C 是否提供 REST API 用于登录?

[英]Does Azure B2C provide REST API for login?

I have one application integrated with Azure B2C directory.我有一个与 Azure B2C 目录集成的应用程序。 Our problem is, login page is redirecting to Azure B2C portal (Own custom page) for authenticate or Authorize users and then revert back to the original website.我们的问题是,登录页面重定向到 Azure B2C 门户(自己的自定义页面)以验证或授权用户,然后恢复到原始网站。

I need to open popup with my own website login design and at the backend, I am able to call Azure B2C REST api to validate users.我需要使用自己的网站登录设计打开弹出窗口,并且在后端,我可以调用 Azure B2C REST api 来验证用户。

How I can create REST API for Login in Azure B2C portal?如何创建 REST API 以登录 Azure B2C 门户?

Let me know if you have any information about the same.如果您有任何相同的信息,请告诉我。

As juunas said in the comment, you could use resource owner password credentials(ROPC) flow to validate users at the backend.正如 juunas 在评论中所说,您可以使用资源所有者密码凭据 (ROPC) 在后端验证用户。 You could call the API with the POST request at the end.您可以在最后使用 POST 请求调用 API。 Note: ROPC supports local accounts only.注意: ROPC 仅支持本地帐户。

Try to create resource owner user flow first.尝试先创建资源所有者用户流。

在此处输入图像描述

You need to replace the username and password with the user's to be verified.您需要将usernamepassword替换为要验证的用户。

POST https://<tenant-name>.b2clogin.com/<tenant-name>.onmicrosoft.com/B2C_1A_<ROPC_Auth name of the flow>/oauth2/v2.0/token

username=<username>
&password=<password>
&grant_type=password
&scope=openid <application-id> offline_access
&client_id=<application-id>
&response_type=token+id_token

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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