无法使用yampy获取访问令牌

时间:2019-07-19 17:33:17

标签: yammer

我使用Yampy获取访问令牌,但输出返回错误请求。我具有客户端ID,客户端密码和令牌。现在,我需要使用获得访问令牌的令牌。这是我的一些代码:

token = 'mytoken'
client_id = 'my client ID'
client_secret = 'my secret'
redirect_uri = 'my call back url'

authenticator = yampy.Authenticator(client_id = client_id, client_secret=client_secret)
auth_url = authenticator.authorization_url(redirect_uri=redirect_uri)
access_token = authenticator.fetch_access_token(token)

错误消息显示为:

    ---------------------------------------------------------------------------
ResponseError                             Traceback (most recent call last)
<ipython-input-49-4f8964da127d> in <module>
----> 1 access_token = authenticator.fetch_access_token(token)

~\anaconda\lib\site-packages\yampy\authenticator.py in fetch_access_token(self, code)

~\anaconda\lib\site-packages\yampy\authenticator.py in fetch_access_data(self, code)

~\anaconda\lib\site-packages\yampy\client.py in get(self, path, **kwargs)

~\anaconda\lib\site-packages\yampy\client.py in _request(self, method, path, **kwargs)

~\anaconda\lib\site-packages\yampy\client.py in _parse_response(self, response)

ResponseError: 400 error: Bad Request

我也尝试了以下代码:

access_data = authenticator.fetch_access_data(token)
access_token = access_data.access_token.token
user_info = access_data.user
network_info = access_data.network

但它还会报告错误的请求错误。

0 个答案:

没有答案