diff --git a/oauth3.core.js b/oauth3.core.js index ca4cfdd..526be8e 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -616,7 +616,7 @@ return OAUTH3._discoverHelper(providerUri, opts).then(function (directives) { directives.azp = directives.azp || OAUTH3.url.normalize(providerUri); directives.issuer = directives.issuer || OAUTH3.url.normalize(providerUri); - directives.api = (directives.api||':hostname').replace(/:hostname/, directives.issuer || OAUTH3.url.normalize(providerUri)); + directives.api = OAUTH3.url.normalize((directives.api||':hostname').replace(/:hostname/, OAUTH3.uri.normalize(directives.issuer) || OAUTH3.uri.normalize(providerUri))); // OAUTH3.PromiseA.resolve() is taken care of because this is wrapped return OAUTH3.hooks.directives.set(providerUri, directives); }); @@ -1087,8 +1087,8 @@ if (!me._providerUri) { throw new Error("'providerUri' was not supplied"); } - opts.session.provider_uri = me._providerUri - opts.session.client_uri = me._clientUri + opts.session.provider_uri = me._providerUri; + opts.session.client_uri = me._clientUri; me.session(opts.session, opts.sessionId); } }