【发布时间】:2024-05-17 23:05:02
【问题描述】:
考虑这个 Azure AD OAuth 2.0 设备流授权请求:
POST https://login.microsoftonline.com/common/oauth2/devicecode
Content-Type: application/x-www-form-urlencoded
client_id=12345678-1234-1234-1234-123456789012
&grant_type=device_code
&resource=https://graph.microsoft.com
(为了便于阅读,跳过了 urlencoding)
根据this draft,响应应该包含verification_uri参数:
verification_uri
必填。授权服务器上的最终用户验证 URI。 URI 应该简短易记,因为最终用户将被要求手动将其输入到他们的用户代理中。
{
"device_code": "GMMhmHCXhWEzkobqIHGG_EnNYYsAkukHspeYUk9E8",
"user_code": "WDJB-MJHT",
"verification_uri": "https://www.example.com/device",
...
但是来自 Azure AD 的响应包含
verification_url 代替(注意url 而不是uri):
"verification_url": "https://aka.ms/devicelogin"
这只是 Azure AD 的设备流实现中的一个错字吗?
我应该将这两种变体都视为有效吗?这是在下一个草案中重命名为verification_url 吗?
还有一个问题,我可以从 Azure AD v2 端点请求设备流授权吗?
令牌端点似乎以/common/oauth2/v2.0/token 存在,但其代码请求对应方返回404、/common/oauth2/v2.0/devicecode。
有一个/common/oauth2/devicecode,但我以后无法将它与/common/oauth2/v2.0/devicecode 一起使用(立即返回AADSTS70019 验证码已过期。)。
【问题讨论】:
标签: azure oauth-2.0 azure-active-directory