2016-06-28 64 views
1

我正在嘗試使用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 

我不斷收到什麼是

{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} 

究竟什麼是錯誤的,該怎麼辦呢?

回答

相關問題