Monday 15 August 2011

Does the quick-start Python Gmail API code handle refresh tokens? -



Does the quick-start Python Gmail API code handle refresh tokens? -

does quick-start code handle refresh tokens? if so, where/how?

https://developers.google.com/gmail/api/quickstart/quickstart-python

i working on python application needs have continuous/unfettered access gmail business relationship emails, want create sure handling scenario described on page:

https://developers.google.com/gmail/api/auth/web-server#send_authorized_requests_and_check_for_revoked_credentials

specifically, "if application requires offline access, first time app exchanges authorization code, receives refresh token uses receive new access token after previous token has expired. application stores refresh token (generally in database on server) later use" paragraph.

it's not clear me if/how handled quick-start code. thanks!

i figured out. refresh token, if saved offline access application, used perpetually request new access tokens (as short lived/expire). quick-start code save refresh token in stored credentials (the storage file) , wraps oauth 2.0 methods new access tokens authorization server when needed.

if reason need refresh token, can request 1 authorization server, after making user approve application again:

from https://developers.google.com/gmail/api/auth/web-server "always store user refresh tokens. if application needs new refresh token must sent request approval_prompt query parameter set force. cause user see dialog grant permission application again."

more info authorization server requests: https://developers.google.com/accounts/docs/oauth2webserver

python gmail-api

No comments:

Post a Comment