@mybiogen/auth-openid
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -39,3 +39,4 @@ import { OAuthUserInfo, Token, WatchAuthCallback, Init, AuthenticateExtraParams } from './types'; | ||
private getToken; | ||
refreshToken: () => Promise<Init | undefined>; | ||
refreshToken: () => Promise<Token | undefined>; | ||
getRefreshedToken: () => Promise<Token | undefined>; | ||
private authenticate; | ||
@@ -42,0 +43,0 @@ login: (forcedRedirectTo?: string | undefined, extraParams?: AuthenticateExtraParams | undefined) => void; |
@@ -121,8 +121,2 @@ "use strict"; | ||
_a.sent(); | ||
if (!this.token) return [3, 3]; | ||
return [4, this.getUserInfo()]; | ||
case 2: | ||
_a.sent(); | ||
_a.label = 3; | ||
case 3: | ||
this.callListeners(); | ||
@@ -206,2 +200,3 @@ return [2]; | ||
expiresIn: authToken.expires_in, | ||
expiresAt: new Date().getTime() + authToken.expires_in * 1000, | ||
tokenType: authToken.token_type, | ||
@@ -259,2 +254,3 @@ scope: authToken.scope, | ||
expiresIn: token.expires_in, | ||
expiresAt: new Date().getTime() + token.expires_in * 1000, | ||
tokenType: token.token_type, | ||
@@ -265,6 +261,14 @@ scope: token.scope, | ||
utils_1.Storage.set(this.storageKey + ".token", this.token); | ||
return [2, { accessToken: this.token.accessToken, expiresIn: this.token.expiresIn }]; | ||
return [2, this.token]; | ||
} | ||
}); | ||
}); }; | ||
this.getRefreshedToken = function () { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (this.token && this.token.expiresAt < new Date().getTime()) { | ||
return [2, this.refreshToken()]; | ||
} | ||
return [2, this.token]; | ||
}); | ||
}); }; | ||
this.authenticate = function (args) { | ||
@@ -312,3 +316,3 @@ var forcedRedirectTo = args.forcedRedirectTo, isSignup = args.isSignup, extraParams = args.extraParams; | ||
this.getUserInfo = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var response, userInfo_1, claims, error_4; | ||
var token, response, userInfo_1, claims, error_4; | ||
return __generator(this, function (_a) { | ||
@@ -322,12 +326,17 @@ switch (_a.label) { | ||
case 1: | ||
_a.trys.push([1, 4, , 6]); | ||
_a.trys.push([1, 5, , 7]); | ||
return [4, this.getRefreshedToken()]; | ||
case 2: | ||
token = _a.sent(); | ||
if (!token) | ||
throw new Error('No token, cannot get user.'); | ||
return [4, fetch(this.userInfoEndpoint, { | ||
headers: new Headers({ | ||
Authorization: "Bearer " + this.token.accessToken, | ||
Authorization: "Bearer " + token.accessToken, | ||
}), | ||
})]; | ||
case 2: | ||
case 3: | ||
response = _a.sent(); | ||
return [4, response.json()]; | ||
case 3: | ||
case 4: | ||
userInfo_1 = _a.sent(); | ||
@@ -342,3 +351,3 @@ claims = this.claims.length | ||
return [2, this.user]; | ||
case 4: | ||
case 5: | ||
error_4 = _a.sent(); | ||
@@ -348,6 +357,6 @@ console.warn('Error getting user info, logging out...'); | ||
return [4, this.logout()]; | ||
case 5: | ||
case 6: | ||
_a.sent(); | ||
return [2, undefined]; | ||
case 6: return [2]; | ||
case 7: return [2]; | ||
} | ||
@@ -449,2 +458,8 @@ }); | ||
_a.token = _b.sent(); | ||
if (!this.token) return [3, 3]; | ||
return [4, this.getUserInfo()]; | ||
case 2: | ||
_b.sent(); | ||
_b.label = 3; | ||
case 3: | ||
this.keepRefreshingToken(); | ||
@@ -467,2 +482,8 @@ window.history.replaceState(window.history.state, document.title, newUrl); | ||
this.token = storageOauth; | ||
if (!this.token) return [3, 2]; | ||
return [4, this.getUserInfo()]; | ||
case 1: | ||
_b.sent(); | ||
_b.label = 2; | ||
case 2: | ||
this.comesFromLogin = false; | ||
@@ -473,16 +494,16 @@ if (!((_a = this.token) === null || _a === void 0 ? void 0 : _a.refreshToken)) { | ||
} | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
_b.label = 3; | ||
case 3: | ||
_b.trys.push([3, 5, , 6]); | ||
return [4, this.refreshToken()]; | ||
case 2: | ||
case 4: | ||
_b.sent(); | ||
this.keepRefreshingToken(); | ||
return [3, 4]; | ||
case 3: | ||
return [3, 6]; | ||
case 5: | ||
err_1 = _b.sent(); | ||
this.token = undefined; | ||
utils_1.Storage.remove(this.storageKey + ".token"); | ||
return [3, 4]; | ||
case 4: return [2, this.token]; | ||
return [3, 6]; | ||
case 6: return [2, this.token]; | ||
} | ||
@@ -501,2 +522,2 @@ }); | ||
exports.default = OpenIDClient; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT0F1dGhDbGllbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvT0F1dGhDbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDhEQUF1QztBQUN2Qyw2QkFBb0M7QUFDcEMsaUNBQTBHO0FBWTFHO0lBdUNFLHNCQUFZLFFBQWdCLEVBQUUsU0FBaUIsRUFBRSxXQUFtQixFQUFFLFVBQWtCLEVBQUUsaUJBQXlCLEVBQUUsTUFBNkIsRUFBRSxNQUFnQztRQUFwTCxpQkFnQ0M7UUFoQ29ILHVCQUFBLEVBQUEsVUFBb0IsUUFBUSxDQUFDO1FBQUUsdUJBQUEsRUFBQSxXQUFnQztRQVZwTCxjQUFTLEdBQStDLEVBQUUsQ0FBQztRQTRIbkQsd0JBQW1CLEdBQUc7O1lBQzVCLElBQUksUUFBQyxLQUFJLENBQUMsS0FBSywwQ0FBRSxZQUFZLENBQUEsRUFBRTtnQkFDN0IsT0FBTyxDQUFDLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxDQUFBO2dCQUN0QyxPQUFPO2FBQ1I7WUFFRCxJQUFJLEtBQUksQ0FBQyxJQUFJLElBQUksS0FBSSxDQUFDLEtBQUssSUFBSSxDQUFDLEtBQUksQ0FBQyxvQkFBb0IsRUFBRTtnQkFDekQsSUFBTSx3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U2Vzc2lvblVSSSk7XG4gICAgfSBlbHNlIHtcbiAgICAgIC8vIE9rdGFKU1xuICAgICAgY29uc3QgcGFyYW1zID0ge1xuICAgICAgICAnaWRfdG9rZW5faGludCc6IHRoaXMudG9rZW4/LmlkVG9rZW4sXG4gICAgICAgICdwb3N0X2xvZ291dF9yZWRpcmVjdF91cmknOiB0aGlzLmxvZ291dFJlZGlyZWN0VVJJLFxuICAgICAgfTtcbiAgICAgIGlmICh0aGlzLmVuZFNlc3Npb25FbmRwb2ludCkge1xuICAgICAgICBjb25zdCB1cmwgPSBgJHt0aGlzLmVuZFNlc3Npb25FbmRwb2ludH0/JHtxdWVyeVN0cmluZy5zdHJpbmdpZnkocGFyYW1zKX1gO1xuICAgICAgICB3aW5kb3cubG9jYXRpb24ucmVwbGFjZSh1cmwpOyAgXG4gICAgICB9XG4gICAgfVxuICB9O1xuXG59XG4iXX0= |
@@ -5,2 +5,3 @@ export declare type Token = { | ||
expiresIn: number; | ||
expiresAt: number; | ||
tokenType: string; | ||
@@ -7,0 +8,0 @@ scope: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8vIFJlZmVyZW5jZTogaHR0cHM6Ly9pZGVudGl0eWRvY3MuYWthbWFpLmNvbS9ob21lL2F1dGhvcml6YXRpb24tY29kZS1wa2NlLWZvci1tb2JpbGUtYXBwc1xuZXhwb3J0IHR5cGUgVG9rZW4gPSB7XG4gIC8vIFRva2VuIHVzZWQgZm9yIGNhbGxzLCBzaG9ydCBleHBpcmF0aW9uXG4gIGFjY2Vzc1Rva2VuOiBzdHJpbmc7XG4gIC8vIFRva2VuIHVz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7XG4gIGZvcmNlZFJlZGlyZWN0VG8/OiBzdHJpbmc7XG4gIGlzU2lnbnVwPzogYm9vbGVhbjtcbiAgZXh0cmFQYXJhbXM/OiBBdXRoZW50aWNhdGVFeHRyYVBhcmFtcztcbn1cblxuZXhwb3J0IHR5cGUgQ2xhaW1QYXJhbSA9IHtcbiAgW2NsYWltOiBzdHJpbmddOiBudWxsLFxufTtcbiJdfQ== |
{ | ||
"name": "@mybiogen/auth-openid", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "Authorization for OpenID", | ||
@@ -35,3 +35,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "d01f659ff35b6ffc9dfd5e7800c32af7d2b9f7b5" | ||
"gitHead": "647318e5304e823447e444e2b9fd9c5fbbe9173c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
103171
36
919