I'm trying to use the OAuth Token I get from django-social-auth to access the users calendars.
So in the django-social-auth configuration I set:
GOOGLE_CONSUMER_KEY = 'anonymous'
GOOGLE_CONSUMER_SECRET = 'anonymous'
GOOGLE_OAUTH_EXTRA_SCOPE = ['https://www.google.com/calendar/feeds/']
When the user comes back from google, I get an entry in the database which lookes like this:
{u'access_token': u'oauth_token_secret=vvvv&oauth_token=xxxx'}
But now, when I try do something like this:
import gdata.calendar.client
client = gdata.calendar.client.CalendarClient()
client.auth_token = gdata.gauth.OAuthHmacToken('anonymous', 'anonymous', 'xxxx', 'vvvv', gdata.gauth.ACCESS_TOKEN)
client.GetOwnCalendarsFeed()
I always get:
gdata.client.Unauthorized: Unauthorized - Server responded with: 401
<HEAD>
<TITLE>Token invalid - Invalid AuthSub token.</TITLE>
</HEAD>
What am I missing here?
This works for me:
from social_auth.models import UserSocialAuth
def do_something_with_tokens(request):
tokens = UserSocialAuth.get_social_auth_for_user(request.user).get().tokens
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With