[libgdata] core: Don’t unset refresh token on ref reshing OAuth 2.0 authorisation



commit 14cc74587533428d6bf26cdbaa35601d16d721ee
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Sep 21 17:29:08 2014 +0100

    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.

 gdata/gdata-oauth2-authorizer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-oauth2-authorizer.c b/gdata/gdata-oauth2-authorizer.c
index faae215..63feea7 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]