[gnome-maps] osmEdit: Don't re-use OAuth proxy used for signing in



commit f3158d5bc6e621d1995927ef0726beae17245a41
Author: Marcus Lundblad <ml update uu se>
Date:   Fri Dec 18 07:15:36 2015 +0100

    osmEdit: Don't re-use OAuth proxy used for signing in
    
    It seems running request_token_async a second time on an OAuthProxy instance
    doesn't work well.
    So, instead create a new proxy each time the login process is being run.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759464

 src/osmConnection.js |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/osmConnection.js b/src/osmConnection.js
index fa36a30..fbb495e 100644
--- a/src/osmConnection.js
+++ b/src/osmConnection.js
@@ -22,8 +22,6 @@
 
 const _ = imports.gettext.gettext;
 
-const Utils = imports.utils;
-
 const Lang = imports.lang;
 const Maps = imports.gi.GnomeMaps;
 const Rest = imports.gi.Rest;
@@ -50,9 +48,7 @@ const OSMConnection = new Lang.Class({
 
     _init: function(params) {
         this._session = new Soup.Session();
-        /* OAuth proxy used for enrolling access tokens */
-        this._oauthProxy = Rest.OAuthProxy.new(CONSUMER_KEY, CONSUMER_SECRET,
-                                               OAUTH_ENDPOINT_URL, false);
+
         /* OAuth proxy used for making OSM uploads */
         this._callProxy = Rest.OAuthProxy.new(CONSUMER_KEY, CONSUMER_SECRET,
                                               BASE_URL + '/' + API_VERSION,
@@ -225,6 +221,9 @@ const OSMConnection = new Lang.Class({
     },
 
     requestOAuthToken: function(callback) {
+        /* OAuth proxy used for enrolling access tokens */
+        this._oauthProxy = Rest.OAuthProxy.new(CONSUMER_KEY, CONSUMER_SECRET,
+                                               OAUTH_ENDPOINT_URL, false);
         this._oauthProxy.request_token_async('request_token', 'oob', function(p, error, w, u) {
             this._onRequestOAuthToken(error, callback);
         }.bind(this), this._oauthProxy, callback);


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