Azure AD-如何获取v2访问令牌

问题描述:

使用Azure AD,OIDC隐式流,我可以从v2终结点获取访问令牌.我正在使用的授权端点如下所示:

Using Azure AD, OIDC implicit flow, I can obtain an access token from a v2 endpoint. The authorization endpoint I am using looks like this:

https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize?client_id=<client-id>&redirect_uri=https://localhost:44321/signin-oidc&response_type=id_token%20token&scope=openid%20api%3A%2F%2Fdev-api-gateway%2FAtlas&response_mode=form_post&nonce=123

但是,看来我得到了"v1"访问令牌.我在做什么错了?

Yet, it seems that I get a 'v1' access token. What am I doing wrong?

获取的令牌版本与受v1端点或v2端点保护的访问资源有关.

The acquired token version is related to your access resource that is protected by v1 endpoint or v2 endpoint.

在我这一边,该API在v2端点中受保护,因此它返回了v2 access_token.

On my side, the API is protected in v2 endpoint, so it returned the v2 access_token.

https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize?client_id=<client-id>&redirect_uri=https://snv2app.azurewebsites.net&response_type=id_token+token&scope=openid api://f3d966c0-517e-4e13-a5bb-9777a916b1a0/User.read&response_mode=fragment&nonce=123

并解析access_token:

And to parse access_token: