我正在尝试使用API,我可以通过使用主凭据获取临时访问令牌但无法访问API,我已尝试将令牌编码为base64但我得到相同的错误。
import requests
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
client_id='Client ID'
client_secret='Client Secret'
#fetch Temporary access token
client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url='https://login.burning-glass.com/v2/oauth/token', client_id=client_id,client_secret=client_secret)
#get access_token
access_token=token['access_token']
#Access endpoint with temporary token.
headers={'Authorization':'Bearer '+access_token}
page = oauth.post('https://apis.burning-glass.com/v2.1/similarity/skills',headers=x)
print page.content
我得到了这个API响应:
{"error":"access_denied","error_description":"Invalid token does not contain resource id (authorizationserverv1.0)"}
我在这里缺少什么?