How to automate login to Google API to get OAuth 2.0 token to access known user account

Posted by keyser_sozay on Stack Overflow See other posts from Stack Overflow or by keyser_sozay
Published on 2012-03-21T17:26:43Z Indexed on 2012/03/21 17:29 UTC
Read the original article Hit count: 242

Ok, so this question has been asked before here. In the response/answer to the question, the user tells him to store the token in the application (session and not db, although it doesn't matter where you store it). After going through the documentation on Google, it seems that the token has an expiration date after which it is no longer valid. Now, we could obviously automatically refresh the token every fixed interval, thereby prolonging the lifespan of the token, but for some reason, this manual process feels like a hack. My questions is:

  • Is this most effective (/generally accepted) way to access google calendar/app data for a known user account by manually logging in and persisting the token in the application? Or is there another mechanism that allows us to programmatically login to this user account and go through the OAuth steps?

© Stack Overflow or respective owner

Related posts about google-api

Related posts about oauth-2.0