To access TokenInfo I use the Google APIs Client Library for Python (oauth2client app engine). I have received an oauth2 access token and this code works fine:
@decorator.oauth_aware
def get(self):
....
....
if decorator.has_credentials() :
body = urllib.urlencode({'access_token': decorator.credentials.access_token})
http = httplib2.Http()
resp, content = http.request("https://www.googleapis.com/oauth2/v1/tokeninfo",method="POST", body=body)
But when I use the decorator to create an authorized http instance:
@decorator.oauth_aware
def get(self):
....
....
if decorator.has_credentials() :
http = decorator.http()
resp, content = http.request("https://www.googleapis.com/oauth2/v1/tokeninfo",method="POST")
I receive:
'status' : '400'
{
"error": "invalid_token",
"error_description": "either access_token or id_token required"
}
UPDATE-1
I studied oauth2client\client.py : decorator.http() not only authorizes the request, but also refreshes the access_token if it has been expired.
I very welcome ideas on how to solve this? Thanks for your help.
UPDATE-2 AND SOLVED
The TokeInfo API does not need any Authorization. The request itself has to contain the access_token. The Authorization header is ignored.
I studied oauth2client\client.py : decorator.http() not only authorizes the request, but also refreshes the access_token if it has been expired.
I very welcome ideas on how to solve this? Thanks for your help.
UPDATE AND SOLVED
The TokeInfo API does not need any Authorization. The request itself has to contain the access_token. The Authorization header is ignored.