summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2014-09-21 17:29:08 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2014-09-21 17:42:02 +0100
commit14cc74587533428d6bf26cdbaa35601d16d721ee (patch)
tree48327a1fb8ae50c85971a8728498d12d19edc92a
parentfe5a38c0b1d507bae84e41fa5014e91632f0fc25 (diff)
downloadlibgdata-14cc74587533428d6bf26cdbaa35601d16d721ee.tar.gz
core: Don’t unset refresh token on refreshing OAuth 2.0 authorisation
When refreshing an OAuth 2.0 authorisation, only a new access token is returned by the server — the refresh token is left unchanged, so a new one is not returned. Do not use that as an excuse to forget the existing refresh token.
-rw-r--r--gdata/gdata-oauth2-authorizer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdata/gdata-oauth2-authorizer.c b/gdata/gdata-oauth2-authorizer.c
index faae2158..63feea79 100644
--- a/gdata/gdata-oauth2-authorizer.c
+++ b/gdata/gdata-oauth2-authorizer.c
@@ -977,8 +977,10 @@ done:
g_free (priv->access_token);
priv->access_token = g_strdup (access_token);
- g_free (priv->refresh_token);
- priv->refresh_token = g_strdup (refresh_token);
+ if (refresh_token != NULL) {
+ g_free (priv->refresh_token);
+ priv->refresh_token = g_strdup (refresh_token);
+ }
g_mutex_unlock (&priv->mutex);