2009/2/23 alee <[email protected]>: > > I have my own Web application that maintains the session tokens for > our Google Calendar users. > With 1.2.*, AuthSub token management changed as per 2nd link: > http://code.google.com/p/gdata-python-client/wiki/AuthOnAppEngine > http://code.google.com/p/gdata-python-client/wiki/HTTPRequestRefactoring > The former talks about token store design for AppEngine. The latter > mentions more about Token Management. > > My question is how to use the GDataService APIs since it now has its > own token_store. I have session tokens (string along with scopes) > saved in my own database. Periodically, from day to day, I connect on > behalf of all users who have granted permission in our Web app service > to fetch updates of their calendars. So, I tried to do the following, > after retrieving session_token_string from database for each user. > > calendar_service = gdata.calendar.service.CalendarService() > calendar_service.SetAuthSubToken(session_token_string, ['http:// > www.google.com/calendar/feeds/']) > #check if AuthSub is valid > calendar_service.AuthSubTokenInfo() > > When calling AuthSubTokenInfo, I get the following exception: > <HTML>\n<HEAD>\n<TITLE>Invalid AuthSub token.</TITLE>\n</HEAD>\n<BODY > BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid AuthSub token.</H1> > \n<H2>Error 403</H2>\n</BODY>\n</HTML> > > I've looked around at all the documentation on Google Data API > including the guides on AuthSub to try to understand how the new > changes affect using gdata.py but am clearly missing some critical > information. The documentation has been helpful on acquiring a single > use token, conversion to session token and use of the session token a > query if this whole flow is done in one session. However, for a > daemon process that then tries to use this session token periodically > to scan for new updates, there is clearly something missing from aside > from calling SetAuthSubToken. > > Any suggestions on what I might be doing wrong? > > Alison
Alison, I discussed this Jeff Scudder, who is the principal author for the Python Google Data client library. Here was what he suggested: 2009/2/23 Scudder <[email protected]>: > Ok, here's something to try. > > Before calling SetAuthSubToken, be sure to set auto_set_current_token to True. > > calendar_service = gdata.calendar.service.CalendarService() > calendar_service.auto_set_current_token = True > calendar_service.SetAuthSubToken(session_token_string, > ['http://www.google.com/calendar/feeds/']) > > Or even better, you could do > > calendar_service = > gdata.alt.appengine.run_on_appengine(gdata.calendar.service.CalendarService()) > Then just use > calendar_service.SetAuthSubToken(session_token_string, > ['http://www.google.com/calendar/feeds/']) > > If the user is signed in to the app, then the above will work just fine. If, > however, there is no user signed in to the app, I recommend using: > calendar_service = > gdata.alt.appengine.run_on_appengine(gdata.calendar.service.CalendarService(), > False, True) Please give that a try and let us know if it works. -- Trevor Johns --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
