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) {