From 1b93df337118a0c5891f0e3beb9f53168b600f67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 17 Apr 2017 03:54:20 +0000
Subject: [PATCH] fixup! erp5_oauth_google_login: Set access_type as offline to
 be possible refresh token in background and automatically

refreshing token was not working because of incorrect API usage
---
 product/ERP5Security/ERP5ExternalOauth2ExtractionPlugin.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Security/ERP5ExternalOauth2ExtractionPlugin.py b/product/ERP5Security/ERP5ExternalOauth2ExtractionPlugin.py
index 78d2de5b62..64d58c053c 100644
--- a/product/ERP5Security/ERP5ExternalOauth2ExtractionPlugin.py
+++ b/product/ERP5Security/ERP5ExternalOauth2ExtractionPlugin.py
@@ -254,8 +254,8 @@ class ERP5GoogleExtractionPlugin(ERP5ExternalOauth2ExtractionPlugin, BasePlugin)
          cache_value["client_secret"], refresh_token,
          cache_value["token_expiry"], cache_value["token_uri"],
          cache_value["user_agent"])
-       response_data = credential.refresh(httplib2.Http())
-       cache_value.update(response_data)
+       credential.refresh(httplib2.Http())
+       cache_value = json.loads(credential.to_json())
        cache_value["response_timestamp"] = time.time()
        self.setToken(key, cache_value)
     return cache_value
-- 
2.30.9