google-code-export / gdata-python-client

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

CalendarResourceClient doesn't appear to support 2-legged OAuth #524

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a gdata.calendar.client.CalendarResourceClient
2. Give it a gdata.gauth.TwoLeggedOAuthHmacToken as it's auth_token
3. Try to create a calendar resource.

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

I expect a calendar resource to be created. Instead, I see:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gdata/calendar_resource/client.py", line 154, in create_resource

    return self.post(new_resource, self.MakeResourceFeedUri(), **kwargs)
  File "/usr/lib/python2.7/site-packages/gdata/client.py", line 684, in post
    desired_class=desired_class, **kwargs)
  File "/usr/lib/python2.7/site-packages/gdata/client.py", line 307, in request
    response, Unauthorized)
Unauthorized: Unauthorized - Server responded with: 401, <HTML>
<HEAD>
<TITLE>Unknown authorization header</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unknown authorization header</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

What version of the product are you using?

2.0.14

Please provide any additional information below.

The TwoLeggedOAuthHmacToken works for the Docs client, for example.

Original issue reported on code.google.com by cc...@nougat.org on 20 Jun 2011 at 9:19

GoogleCodeExporter commented 9 years ago
Actually 2-legged Oauth is currently not enabled for write access with the 
Calendar Resource API

If you want to access it in read-only mode, first make sure you enabled the 
following scope for your domain in your control panel:
https://apps-apis.google.com/a/feeds/calendar/resource/#readonly

Then pass an empty string as xoauth_requestor_id, as in the following code 
snippet:

        two_legged_oauth_token = gdata.gauth.TwoLeggedOAuthHmacToken(CONSUMER_KEY, CONSUMER_SECRET, '')
        clr = gdata.calendar_resource.client.CalendarResourceClient(YOUR_DOMAIN)
        clr.auth_token = two_legged_oauth_token
        print clr.GetResourceFeed()

Original comment by pro...@google.com on 29 Jun 2011 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by ccherub...@google.com on 29 Jun 2011 at 1:38