如何创建Azure Web应用程序以对用户进行身份验证并获取其访问令牌? [英] How can I create a Azure Web Application to authenticate User and acquire its Access Token?
问题描述
我想创建一个Azure Web应用程序,当通过Azure AD凭据打开Web应用程序链接时,可以对外部/内部(来自任何组织)用户进行身份验证,并获取其访问令牌.
I want to create an Azure Web Application that can authenticate an external/internal (from any Organization) user upon opening the Web Application link through Azure AD Credentials and acquire its Access token in return.
我想使用该访问令牌以编程方式在用户的租户中创建应用程序注册.
I want to use that Access Token to programmatically create an application registration in User's tenant.
推荐答案
首先,您需要多租户应用程序,然后使用身份验证代码流来对用户并获得访问令牌.
First, you need to register an application and set it as a multi-tenant application, then use the auth code flow to authenticate the user and obtain an access token.
Next, you need to use the access token to call the MS graph api to create an application, because you are using the auth code flow to obtain the token, so you need to grant delegation permissions
to the application.
请参阅:样本.
这篇关于如何创建Azure Web应用程序以对用户进行身份验证并获取其访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!