From 243808148780fc0007892e43ebc257bd6c20a32f Mon Sep 17 00:00:00 2001 From: tigerbot Date: Mon, 13 Nov 2017 13:56:58 -0700 Subject: [PATCH] fixed `this` scoping problem introduced with `_getCached` fix --- oauth3.core.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/oauth3.core.js b/oauth3.core.js index 8e98e6d..853f1e7 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -1433,23 +1433,25 @@ }); } , logout: function (opts) { - this._session = false; + var me = this; + me._session = false; opts = opts || {}; - return OAUTH3.hooks.session.get(this._identityProviderUri).then(function (session) { - opts.client_uri = this._clientUri; - opts.client_id = this._clientUri; + return OAUTH3.hooks.session.get(me._identityProviderUri).then(function (session) { + opts.client_uri = me._clientUri; + opts.client_id = me._clientUri; opts.session = session; - return OAUTH3.logout(this._identityProviderUri, opts); + return OAUTH3.logout(me._identityProviderUri, opts); }); } , api: function (api, opts) { + var me = this; opts = opts || {}; - return OAUTH3.hooks.session.get(this._identityProviderUri).then(function (session) { + return OAUTH3.hooks.session.get(me._identityProviderUri).then(function (session) { opts.api = api; opts.session = session; - return OAUTH3.api(this._resourceProviderDirectives.api, opts); + return OAUTH3.api(me._resourceProviderDirectives.api, opts); }); } , pkg: function (pkgname) {