signin-oidc成功后如何获取访问令牌?

时间:2020-08-25 03:46:18

标签: azure azure-active-directory openid-connect asp.net-core-3.1

我在Azure Active Directory应用程序注册中配置了此功能。成功的signin-oidc之后,响应在formdata中具有id_token,但是我也在寻找access_token,因为在我的配置中对其进行了检查。

https://github.com/utec/geofrontend-server

1 个答案:

答案 0 :(得分:0)

在执行登录请求时,您可能未设置 token 响应,尝试将 response_type 设置为 id_token + token ,您将获得id_token和访问令牌。

在浏览器中执行请求:

GET https://login.microsoftonline.com/e4c9ab4e-bd27-40d5-8459-230ba2axxxxx/oauth2/v2.0/authorize?
client_id=305c9958-8f6f-4bcf-a4ec-06cb4faxxxxx
&response_type=id_token+token
&redirect_uri=https://jwt.ms
&response_mode=fragment
&scope=openid+profile+email 
&state=12345
&nonce=678910

请参阅:Get an access token