Azure AD - 如何获取 v2 访问令牌 [英] Azure AD - how to obtain v2 access token

查看:28
本文介绍了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?

推荐答案

获取的token版本与你的受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:

这篇关于Azure AD - 如何获取 v2 访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆