Kul*_*ade 3 python tornado oauth-2.0
我尝试使用OAuth 1.0和2.0访问Google的API,在这两种情况下,我需要填充标题中的授权字段,其值为"OAuth",后跟访问令牌.我尝试了以下方法,但Google向我发出一条错误消息,指出授权标头值存在问题.我正在使用Python-Tornado
additional_headers = {
"Authorization": "OAuth "+GoogleOAuth2Mixin.access_token,
"Accept-Encoding": None
}
h = httputil.HTTPHeaders()
h.parse_line("Authorization: OAuth "+GoogleOAuth2Mixin.access_token)
request = httpclient.HTTPRequest(self._USER_INFO_URL+"?access_token="+GoogleOAuth2Mixin.access_token, method="GET", headers=h)
self.httpclient_instance.fetch(
request,
self.async_callback(callback)
)
Run Code Online (Sandbox Code Playgroud)
我尝试使用这两种方法,通过传递标题'h'和'additional_headers',但它不起作用.什么是准确的方法?
use*_*061 11
我有同样的问题.如果'Bearer'被包含在前缀中,它就有效.
Authorization: Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
Run Code Online (Sandbox Code Playgroud)