@obelisk/client
Advanced tools
Comparing version 2.8.4 to 2.8.5
@@ -23,3 +23,2 @@ import { Observable, Observer } from 'rxjs'; | ||
private useOfflineToken; | ||
private lastRedirectUri; | ||
private readonly defaultOptions; | ||
@@ -123,2 +122,7 @@ /** | ||
/** | ||
* Removes last slash if present | ||
* @param uri | ||
*/ | ||
private normalizeRedirectUri; | ||
/** | ||
* @hidden | ||
@@ -125,0 +129,0 @@ * TODO: Schedules a token refresh WITHIN the expiry date timeframe. Useful for implicit token refreshes. |
@@ -22,3 +22,2 @@ "use strict"; | ||
this.useOfflineToken = false; | ||
this.lastRedirectUri = null; | ||
this.defaultOptions = { | ||
@@ -147,5 +146,3 @@ authMode: 'entitlement', | ||
params += 'client_id=' + encodeURIComponent(opt.clientId); | ||
params += '&redirect_uri=' + encodeURIComponent(red_uri); | ||
// Store redirect_uri | ||
this.lastRedirectUri = encodeURIComponent(red_uri); | ||
params += '&redirect_uri=' + encodeURIComponent(this.normalizeRedirectUri(red_uri)); | ||
// In case of queryString, add as state | ||
@@ -453,3 +450,3 @@ if (queryString !== null) { | ||
params += '&client_id=' + encodeURIComponent(this._options.clientId); | ||
params += '&redirect_uri=' + (this.lastRedirectUri == null ? redUri : this.lastRedirectUri); | ||
params += '&redirect_uri=' + this.normalizeRedirectUri(redUri); | ||
return ajax_1.ajax.post(tokenUrl, params, headers).pipe(operators_1.flatMap(resp => this.storeTokens(resp, hasState, false))); | ||
@@ -469,2 +466,14 @@ } | ||
/** | ||
* Removes last slash if present | ||
* @param uri | ||
*/ | ||
normalizeRedirectUri(uri) { | ||
if (uri.endsWith('/')) { | ||
return uri.slice(0, uri.length - 1); | ||
} | ||
else { | ||
return uri; | ||
} | ||
} | ||
/** | ||
* @hidden | ||
@@ -471,0 +480,0 @@ * TODO: Schedules a token refresh WITHIN the expiry date timeframe. Useful for implicit token refreshes. |
{ | ||
"name": "@obelisk/client", | ||
"version": "2.8.4", | ||
"version": "2.8.5", | ||
"description": "Typescript client to interact with Obelisk on a higher level than the regular ReST API calls.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88311
2300