prayagverma / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

Docs API: GetResources() == 401 with 2LO OAuth 1.0 #620

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. client = gdata.docs.client.DocsClient(source='app_name')
2. client.auth_token = gdata.gauth.TwoLeggedOAuthHmacToken(CONSUMER_KEY, 
CONSUMER_SECRET, requestor_id)
3. client.GetResources()

-------OR---------
1. docs = gdata.docs.service.DocsService()
2. docs.SetOAuthInputParameters(SIG_METHOD, CONSUMER_KEY, CONSUMER_SECRET, 
two_legged_oauth=True, requestor_id)
3. docs.GetDocumentListFeed()

What is the expected output? What do you see instead?

I expect a resource feed of the requester_id's document list. This used to 
work, the 401 error is a new thing. 

What I see instead (with http_client.debug = True):

send: 'GET /feeds/default/private/full?xoauth_requestor_id=user%40gmail.com 
HTTP/1.1\r\nHost: docs.google.com\r\nAccept-Encoding: 
identity\r\nGData-Version: 3.0\r\nAuthorization: OAuth oauth_nonce="123", 
oauth_timestamp="123", oauth_consumer_key="123", 
oauth_signature_method="HMAC-SHA1", oauth_version="1.0", 
oauth_signature="123"\r\nUser-Agent: app_name gdata-py/2.0.17\r\n\r\n'
reply: 'HTTP/1.1 401 Unknown authorization header\r\n'
header: WWW-Authenticate: GoogleLogin 
realm="http://www.google.com/accounts/ClientLogin", service="writely"

You can replicate the problem yourself using the official samples from the 
client library (and 2LO OAuth 1.0):

http://code.google.com/p/gdata-python-client/source/browse/samples/oauth/2_legge
d_oauth.py
http://code.google.com/p/gdata-python-client/source/browse/samples/docs/docs_v3_
example.py

What version of the product are you using?

gdata-2.0.17
Docs List API v3 
Python 2.7

Please provide any additional information below.

The error doesn't say Bad Authorization/Unauthorized Access, it says it can't 
understand the authorization header. I also have no idea why it's referencing 
"ClientLogin" in the HTTP response.. I'm not using that. I'd guess this is an 
API change on the back end that the client library hasn't been updated for. I 
confirmed I'm using SSL and default scopes defined in the library 
(https://docs.google.com/feed/), not defining those myself.

Please help, this is a show stopper for me.

Thanks!

AB

Original issue reported on code.google.com by r...@majestik.net on 4 Jun 2012 at 1:03