Oauth 2.0 正在请求Auth0授权扩展中的组列表,但返回403:范围不足错误

Oauth 2.0 正在请求Auth0授权扩展中的组列表,但返回403:范围不足错误,oauth-2.0,authorization,auth0,Oauth 2.0,Authorization,Auth0,我已经在Auth0帐户中安装了Authorization扩展,因此授权功能非常有效,但现在我想访问我在该授权扩展中创建的所有组。因此,我遵循了授权文档,但当我使用为此生成的令牌时,它会抛出403:作用域不足错误作为响应 以下是我经历的步骤: 1.请求令牌: curl -X POST \ https://my_domain.auth0.com/oauth/token \ -H 'cache-control: no-cache' \ -H 'content-type: applicat

我已经在Auth0帐户中安装了
Authorization
扩展,因此授权功能非常有效,但现在我想访问我在该授权扩展中创建的所有组。因此,我遵循了授权文档,但当我使用为此生成的令牌时,它会抛出
403:作用域不足
错误作为响应

以下是我经历的步骤:

1.请求令牌:

 curl -X POST \
  https://my_domain.auth0.com/oauth/token \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
    "client_id":"auth0-authorization-extension-api-client-id",
    "client_secret":"auth0-authorization-extension-api-secret",
    "audience":"urn:auth0-authz-api",
    "grant_type":"client_credentials"
}'
答复:

{"access_token":"encoded_access_token","expires_in":86400,"token_type":"Bearer"}
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Insufficient scope"
}
2.请求的组列表:

 curl -X GET \
  https://domain.us.webtask.io/some_hash/api/groups \
  -H 'authorization: Bearer access_token'
答复:

{"access_token":"encoded_access_token","expires_in":86400,"token_type":"Bearer"}
{
  "statusCode": 403,
  "error": "Forbidden",
  "message": "Insufficient scope"
}

希望这对您来说不是问题,但如果是:

  • 转到Auth0仪表板
  • 点击API
  • 您应该有一个名为auth0授权扩展API的API
  • 选择“非交互式客户端”选项卡
  • 选择要授予访问权限的客户端,并将切换更改为“已授权”
  • 授权切换旁边有一个下拉箭头,单击该箭头,然后在“作用域”下授予对“读取:组”的访问权限。您可能也需要阅读:用户
  • 希望有帮助,谢谢

    凯文