@obelisk/client
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -324,2 +324,5 @@ "use strict"; | ||
let storeTokens = (resp, hasState, offlineLoginHandling) => { | ||
if (resp.status >= 400) { | ||
return rxjs_1.of(false); | ||
} | ||
const authResponse = resp.response; | ||
@@ -356,8 +359,7 @@ const pat = new auth_1.Token(authResponse.access_token); | ||
if (!offlineLoginHandling && authResponse.scope.split(' ').includes('offline_access') && authResponse.refresh_expires_in === 0) { | ||
this._storage.add('logInfo', { authenticated: true, expires: pat.getExpiresAt(), offline_token: patRefresh.getToken() }); | ||
// this._storage!.add('logInfo', { authenticated: true, expires: -1, offline_token: patRefresh.getToken() }); | ||
this._storage.add('offline', { token: patRefresh.getToken() }); | ||
} | ||
else { | ||
// store logged in + expiration | ||
this._storage.add('logInfo', { authenticated: true, expires: pat.getExpiresAt() }); | ||
} | ||
// store logged in + expiration | ||
this._storage.add('logInfo', { authenticated: true, expires: pat.getExpiresAt() }); | ||
// this.scheduleTokenRefresh(pat, patRefresh); | ||
@@ -376,7 +378,4 @@ this.authOver$.next(); | ||
/** OFFLINE TOKEN FOUND: remembered you */ | ||
const logInfo = this._storage.get('logInfo'); | ||
if (logInfo && logInfo.offline_token) { | ||
// console.log('OFFLINE TOKEN FOUND'); | ||
let offline_token = logInfo.offline_token; | ||
console.log(offline_token); | ||
const offline = this._storage.get('offline'); | ||
if (offline && offline.token) { | ||
const url = this._uma2Config.token_endpoint; | ||
@@ -387,3 +386,3 @@ const clientId = this._options.clientId; | ||
}; | ||
const params = `client_id=${clientId}&grant_type=refresh_token&refresh_token=${offline_token}`; | ||
const params = `client_id=${clientId}&grant_type=refresh_token&refresh_token=${offline.token}`; | ||
return ajax_1.ajax.post(url, params, headers).pipe(operators_1.flatMap(resp => storeTokens(resp, null, true))); | ||
@@ -390,0 +389,0 @@ } |
{ | ||
"name": "@obelisk/client", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "Typescript client to interact with Obelisk on a higher level than the regular ReST API calls.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
109572
2873