azure - 请求范围为 "Expose an API” 的 token 时出错。 AADSTS70011 :The provided value for the input parameter 'scope' is not valid

标签 azure authentication scope azure-active-directory

我已添加scopeAzure 门户 上“公开 API”,引用 Microsoft document并授予API permission到那个范围。之后,我使用 postman 请求 token 它返回错误 AADSTS70011:提供的请求必须包含“范围”输入参数。为输入参数“范围”提供的值无效。

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

这样的范围

我已经尝试过这个link ,但没有成功。

postman

最佳答案

您使用了错误的身份验证流程,并且您已授予委派权限。在这种情况下,您应该使用 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
  • 使用授权代码兑换访问 token :
  • enter image description here

    关于azure - 请求范围为 "Expose an API” 的 token 时出错。 AADSTS70011 :The provided value for the input parameter 'scope' is not valid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66475384/

    相关文章:

    Azure 应用服务无法验证 .pfx 文件 : Certificate failed validation because it could not be loaded

    azure - 如何在 Azure 门户中创建或查看现有应用服务计划并进行修改?

    c# - 使用基本身份验证从 Controller 重定向到外部 url

    angularjs - KEYCLOAK - 刷新/更新 token 不起作用

    c++ - Elem 没有命名类型?

    ruby - 对于 ruby​​ 中的深度命名空间,如何最好地管理编码风格和作用域运算符的烦恼?

    c - 初始化为非局部指针后从函数返回指针

    web-services - 如何使用网络安全组仅允许我的 Web 应用程序与我的 Web 服务通信

    android - 使用 ClientID 获取访问 token 时出现 GoogleAuthException

    azure - 如何在azure中监控容器应用指标