express-authenticators
Advanced tools
Comparing version 1.0.0-pre-3 to 1.0.0-pre-4
@@ -95,7 +95,7 @@ "use strict"; | ||
const jsonFetch = (url, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield globalThis.fetch(url, options); | ||
if (!response.ok) { | ||
const res = yield globalThis.fetch(url, options); | ||
if (!res.ok) { | ||
let text; | ||
try { | ||
text = yield response.text(); | ||
text = yield res.text(); | ||
} | ||
@@ -105,7 +105,7 @@ catch (e) { | ||
} | ||
throw new Error(`${response.status}: ${response.statusText} ${text}`); | ||
throw new Error(`${res.status}: ${res.statusText} ${text}`); | ||
} | ||
return yield response.json(); | ||
return yield res.json(); | ||
}); | ||
exports.jsonFetch = jsonFetch; | ||
//# sourceMappingURL=util.js.map |
@@ -34,3 +34,3 @@ export interface IAppleEnv { | ||
tokenType: 'access_token' | 'refresh_token'; | ||
}) => Promise<any>; | ||
}) => Promise<void>; | ||
export declare const getAppleToken: (appleEnv: IAppleEnv, { code, redirectUri }: { | ||
@@ -37,0 +37,0 @@ code: string; |
@@ -135,3 +135,4 @@ "use strict"; | ||
const revokeAppleToken = (appleEnv, { token, tokenType }) => __awaiter(void 0, void 0, void 0, function* () { | ||
return yield (0, util_1.jsonFetch)('https://appleid.apple.com/auth/revoke', { | ||
// response is empty if success | ||
const res = yield (0, util_1.jsonFetch)('https://appleid.apple.com/auth/revoke', { | ||
method: 'POST', | ||
@@ -148,2 +149,12 @@ headers: { | ||
}); | ||
if (!res.ok) { | ||
let text; | ||
try { | ||
text = yield res.text(); | ||
} | ||
catch (e) { | ||
text = e.message; | ||
} | ||
throw new Error(`${res.status}: ${res.statusText} ${text}`); | ||
} | ||
}); | ||
@@ -150,0 +161,0 @@ exports.revokeAppleToken = revokeAppleToken; |
{ | ||
"name": "express-authenticators", | ||
"version": "1.0.0-pre-3", | ||
"version": "1.0.0-pre-4", | ||
"description": "Third party authenticators in nodejs. Support various providers. Almost zero dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
147807
2071