From 35e2a29e4c2d7ee3bca278ce76722c36e3ad03c7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 13 Feb 2017 13:01:13 -0500 Subject: [PATCH] refreshSession on login as well --- oauth3.browser.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/oauth3.browser.js b/oauth3.browser.js index a8a9218..ddc512c 100644 --- a/oauth3.browser.js +++ b/oauth3.browser.js @@ -118,6 +118,15 @@ resolve(tokens); }; }); + }).then(function (tokens) { + return OAUTH3.hooks.refreshSession( + opts.session || { + provider_uri: providerUri + , client_id: opts.client_id + , client_uri: opts.client_uri || opts.clientUri + } + , tokens + ); }); } @@ -260,9 +269,19 @@ } return browser.frameRequest(prequest.url, prequest.state, opts); + }).then(function (tokens) { + return OAUTH3.hooks.refreshSession( + opts.session || { + provider_uri: providerUri + , client_id: opts.client_id + , client_uri: opts.client_uri || opts.clientUri + } + , tokens + ); }); } , implicitGrant: function (providerUri, opts) { + // TODO let broker=true change behavior to open discover inline with frameRequest // TODO OAuth3 provider should use the redirect URI as the appId? return OAUTH3.discover(providerUri, opts).then(function (directive) { var prequest = OAUTH3_CORE.urls.implicitGrant( @@ -276,6 +295,15 @@ } return browser.frameRequest(prequest.url, prequest.state, opts); + }).then(function (tokens) { + return OAUTH3.hooks.refreshSession( + opts.session || { + provider_uri: providerUri + , client_id: opts.client_id + , client_uri: opts.client_uri || opts.clientUri + } + , tokens + ); }); } , logout: function (providerUri, opts) {