Azure Active Directory-获取访问令牌的授权

问题描述 投票:0回答:1

我正在关注https://docs.microsoft.com/en-gb/graph/auth-v2-user,希望从我的Web应用程序中调用Microsoft Graph Api。在本文的第2部分,它说明了如何获取发出请求以获取访问令牌的身份验证代码...

有人可以在第二部分的请求中告知我从哪里获得“代码”吗?我期望这将作为查询字符串参数在重定向URL中返回,但事实并非如此。

谢谢,

oauth-2.0 azure-active-directory authorization
1个回答
0
投票

授权请求应为

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id={client_id}
&response_type=code
&redirect_uri=http://localhost/myapp/
&response_mode=query
&scope=offline_access user.read mail.read
&state=12345

用您的值替换tenantclient_id。并且redirect_uri应该与门户网站中的一致。

enter image description here

在浏览器中请求URL时,将要求您登录。此后,您将在URL中获得code参数。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.