小编itd*_*ork的帖子

Auth0 - 为什么范围不足以及如何处理?

我正在尝试使用 Auth0 进行身份验证并获取用户数据。

import json
import requests

payload = {
    'grant_type': 'password',
    'username': '********',
    'password': '********',
    'client_id': '********',
    'connection': 'Username-Password-Authentication',
    'scope': 'openid'
    # 'scope': 'openid, read:clients, read:client_keys'
    # 'scope': 'read:clients'
}
base = 'https://********.auth0.com'

url = base + '/oauth/ro'
response = requests.post(url, data=payload)
response = json.loads(response.content)

headers = {"Authorization": "bearer " + response["id_token"]}
response = requests.get(base + '/api/v2/clients/joebloggs', headers=headers).json()

print response
Run Code Online (Sandbox Code Playgroud)

我不断得到的是

{u'errorCode': u'insufficient_scope', u'message': u'Insufficient scope, expected any of: read:clients,read:client_keys', u'error': u'Forbidden', u'statusCode': 403}
Run Code Online (Sandbox Code Playgroud)

究竟有什么问题,该怎么办?

python oauth auth0

3
推荐指数
1
解决办法
3130
查看次数

标签 统计

auth0 ×1

oauth ×1

python ×1