我正在尝试使用从 django-social-auth 获得的 OAuth 令牌来访问用户日历。
所以在我设置的 django-social-auth 配置中:
GOOGLE_CONSUMER_KEY = 'anonymous'
GOOGLE_CONSUMER_SECRET = 'anonymous'
GOOGLE_OAUTH_EXTRA_SCOPE = ['https://www.google.com/calendar/feeds/']
当用户从谷歌回来时,我在数据库中得到一个如下所示的条目:
{u'access_token': u'oauth_token_secret=vvvv&oauth_token=xxxx'}
但是现在,当我尝试做这样的事情时:
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()
我总是得到:
gdata.client.Unauthorized: Unauthorized - Server responded with: 401
<HEAD>
<TITLE>Token invalid - Invalid AuthSub token.</TITLE>
</HEAD>
我在这里想念什么?