0

I'm very happy with this answer https://stackoverflow.com/a/8548319/641264 because thanks to it, now I understand well difference between access token and refresh token. I also throwed a glance at the OAuth2WebSercer documentation https://developers.google.com/accounts/docs/OAuth2WebServer But I don't know the functions/methods that can be used to work with refresh token. For access token, we use:

gdata.gauth.ae_save()
gdata.gauth.ae_load()
token.get_access_token()

But what about refresh token?

Community
  • 1
  • 1
tsil
  • 2,069
  • 7
  • 29
  • 43

1 Answers1

0

If you step your way down into the source:
[ae_save source]
[token_to_blob source]

you'll see that token_to_blob is called on the token itself when you call ae_save.

In particular:

elif isinstance(token, OAuth2Token):
  return _join_token_parts(
      '2o', token.client_id, token.client_secret, token.scope,
      token.user_agent, token.auth_uri, token.token_uri,
      token.access_token, token.refresh_token)

so not just the access token is saved, but many other attributes of the token object.

bossylobster
  • 9,993
  • 1
  • 42
  • 61
  • How can I use refresh token? Using refresh token.refresh_token gives an error. – tsil Jul 23 '12 at 22:27
  • This should not be the case. What is the `type(token)`? Even if you don't have a refresh token, the value will be `None`. Before you serialize the token via `ae_save`, make sure you actually have the `refresh_token`. Subsequent OAuth2 requests won't give you a new refresh token unless you specify `approval_prompt=force`. – bossylobster Jul 24 '12 at 02:08