【问题标题】:An error occurred while requesting the token with "Expose an API” scope. AADSTS70011:The provided value for the input parameter 'scope' is not valid请求具有“公开 API”范围的令牌时出错。AADSTS70011:输入参数“范围”的提供值无效
【发布时间】:2021-06-03 02:54:26
【问题描述】:

我已将 scope 添加到 Azure 门户上的“公开 API”,并引用 Microsoft document 并将 API permission 授予该范围。之后我使用postman 请求令牌,它返回错误AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid.

当我尝试这样的范围时,{resource}/.default 工作正常。但是,我需要像{resource}/access_as_user这样的范围

我已经尝试过这个link,但是没有用。

【问题讨论】:

  • 您的问题解决了吗?
  • 查看我的更新。

标签: azure authentication scope azure-active-directory


【解决方案1】:

您使用了错误的身份验证流程,并且您已授予delegated permissions。在这种情况下,您应该使用auth code flow

然后您可以将范围设置为:api://{resource}/access_as_user

添加:

这是我的测试过程:

  1. 首先在浏览器中获取授权码:
https://login.microsoftonline.com/xxxxxxxx-bd27-40d5-8459-230ba2a757fb/oauth2/v2.0/authorize? 
client_id=5f11e827-xxxx-4f1f-aa05-33a33f806aab
&response_type=code
&redirect_uri=https://jwt.ms/index
&response_mode=query
&scope=api://c848e37d-xxxx-4cd8-b9bf-0b2aa6927a82/access_as_user
&state=12345
  1. 使用授权码兑换访问令牌:

【讨论】:

  • 谢谢@Carl Zhao
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-02-01
  • 2014-10-16
  • 2019-06-18
  • 2016-11-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多