resolve providerUri on refreshToken

This commit is contained in:
AJ ONeal 2017-03-16 15:41:33 -06:00
parent 64393a540d
commit bbd75d63eb
1 changed files with 8 additions and 1 deletions

View File

@ -587,6 +587,11 @@
return OAUTH3.hooks.session.check(preq, opts).then(fetch); return OAUTH3.hooks.session.check(preq, opts).then(fetch);
} }
, _requestHelper: function (preq, opts) { , _requestHelper: function (preq, opts) {
/*
if (opts && opts.directives) {
preq.url = OAUTH3.url.resolve(opts.directives.issuer, preq.url);
}
*/
return OAUTH3._browser.request(preq, opts); return OAUTH3._browser.request(preq, opts);
} }
, implicitGrant: function(directives, opts) { , implicitGrant: function(directives, opts) {
@ -666,7 +671,8 @@
return OAUTH3.discover(providerUri, opts).then(function (directive) { return OAUTH3.discover(providerUri, opts).then(function (directive) {
var prequest = OAUTH3.urls.refreshToken(directive, opts); var prequest = OAUTH3.urls.refreshToken(directive, opts);
return OAUTH3.request(prequest).then(function (req) { prequest.url = OAUTH3.url.resolve(providerUri/*directives.issuer*/, prequest.url);
return OAUTH3.request(prequest/*, { directives: directive }*/).then(function (req) {
var data = req.data; var data = req.data;
data.provider_uri = providerUri; data.provider_uri = providerUri;
if (data.error) { if (data.error) {
@ -1071,6 +1077,7 @@
} }
// TODO maybe use a baseUrl from the directives file? // TODO maybe use a baseUrl from the directives file?
preq.url = OAUTH3.url.resolve(this._providerUri, preq.url); preq.url = OAUTH3.url.resolve(this._providerUri, preq.url);
return OAUTH3.request(preq, opts); return OAUTH3.request(preq, opts);
} }
, logout: function (opts) { , logout: function (opts) {