express-authenticators
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -106,14 +106,16 @@ "use strict"; | ||
OAuth.prototype.callback = function (req) { | ||
var _a; | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _b, oauth_token, oauth_verifier, response, _c, _d, token, secret, | ||
var _c, oauth_token, oauth_verifier, sessionSecret, response, _d, _e, token, secret, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
user_id, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
screen_name, _e, _f; | ||
return __generator(this, function (_g) { | ||
switch (_g.label) { | ||
screen_name, _f, _g; | ||
return __generator(this, function (_h) { | ||
switch (_h.label) { | ||
case 0: | ||
_b = req.query, oauth_token = _b.oauth_token, oauth_verifier = _b.oauth_verifier; | ||
if (!((_a = req.session[sessionKey]) === null || _a === void 0 ? void 0 : _a.secret)) | ||
_c = req.query, oauth_token = _c.oauth_token, oauth_verifier = _c.oauth_verifier; | ||
sessionSecret = (_a = req.session[sessionKey]) === null || _a === void 0 ? void 0 : _a.secret; | ||
(_b = req.session[sessionKey]) === null || _b === void 0 ? true : delete _b.secret; | ||
if (!sessionSecret) | ||
throw new OAuthError_1.default('Last token secret lost'); | ||
@@ -127,15 +129,15 @@ return [4 /*yield*/, this.signAndFetch(this.config.accessTokenUrl, { | ||
token: oauth_token, | ||
secret: req.session[sessionKey].secret | ||
secret: sessionSecret | ||
})]; | ||
case 1: | ||
response = _g.sent(); | ||
response = _h.sent(); | ||
if (!!response.ok) return [3 /*break*/, 3]; | ||
_c = OAuthError_1.default.bind; | ||
_d = OAuthError_1.default.bind; | ||
return [4 /*yield*/, response.text()]; | ||
case 2: throw new (_c.apply(OAuthError_1.default, [void 0, _g.sent()]))(); | ||
case 2: throw new (_d.apply(OAuthError_1.default, [void 0, _h.sent()]))(); | ||
case 3: | ||
_f = (_e = qs_1.default).parse; | ||
_g = (_f = qs_1.default).parse; | ||
return [4 /*yield*/, response.text()]; | ||
case 4: | ||
_d = _f.apply(_e, [_g.sent()]), token = _d.oauth_token, secret = _d.oauth_token_secret, user_id = _d.user_id, screen_name = _d.screen_name; | ||
_e = _g.apply(_f, [_h.sent()]), token = _e.oauth_token, secret = _e.oauth_token_secret, user_id = _e.user_id, screen_name = _e.screen_name; | ||
return [2 /*return*/, { | ||
@@ -142,0 +144,0 @@ token: token, |
{ | ||
"name": "express-authenticators", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Third party authenticators in nodejs. Support various providers. Zero heavy dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
113271
2112