fetch-mw-oauth2
Advanced tools
Comparing version 2.0.6 to 2.0.7
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tokenResponseToOAuth2Token = exports.OAuth2Client = void 0; | ||
exports.generateQueryString = exports.tokenResponseToOAuth2Token = exports.OAuth2Client = void 0; | ||
const error_1 = require("./error"); | ||
@@ -206,2 +206,3 @@ const authorization_code_1 = require("./client/authorization-code"); | ||
} | ||
exports.generateQueryString = generateQueryString; | ||
//# sourceMappingURL=client.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCodeVerifier = exports.OAuth2AuthorizationCodeClient = void 0; | ||
exports.generateCodeVerifier = exports.OAuth2AuthorizationCodeClient = void 0; | ||
const client_1 = require("../client"); | ||
@@ -17,5 +17,5 @@ const error_1 = require("../error"); | ||
*/ | ||
async getAuthorizeUri(params) { | ||
async getAuthorizeUri() { | ||
const [codeChallenge, authorizationEndpoint] = await Promise.all([ | ||
getCodeChallenge(params.codeVerifier), | ||
this.codeVerifier ? getCodeChallenge(this.codeVerifier) : undefined, | ||
this.client.getEndpoint('authorizationEndpoint') | ||
@@ -27,4 +27,4 @@ ]); | ||
redirect_uri: this.redirectUri, | ||
code_challenge_method: codeChallenge[0], | ||
code_challenge: codeChallenge[1], | ||
code_challenge_method: codeChallenge === null || codeChallenge === void 0 ? void 0 : codeChallenge[0], | ||
code_challenge: codeChallenge === null || codeChallenge === void 0 ? void 0 : codeChallenge[1], | ||
}; | ||
@@ -34,4 +34,3 @@ if (this.state) { | ||
} | ||
const queryString = new URLSearchParams(query); | ||
return authorizationEndpoint + '?' + queryString.toString(); | ||
return authorizationEndpoint + '?' + (0, client_1.generateQueryString)(query); | ||
} | ||
@@ -77,3 +76,3 @@ /** | ||
exports.OAuth2AuthorizationCodeClient = OAuth2AuthorizationCodeClient; | ||
function getCodeVerifier() { | ||
function generateCodeVerifier() { | ||
const arr = new Uint8Array(32); | ||
@@ -83,3 +82,3 @@ crypto.getRandomValues(arr); | ||
} | ||
exports.getCodeVerifier = getCodeVerifier; | ||
exports.generateCodeVerifier = generateCodeVerifier; | ||
async function getCodeChallenge(codeVerifier) { | ||
@@ -86,0 +85,0 @@ return ['S256', base64Url(await crypto.subtle.digest('SHA-256', stringToBuffer(codeVerifier)))]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OAuth2Error = exports.OAuth2Fetch = exports.getCodeVerifier = exports.OAuth2AuthorizationCodeClient = exports.OAuth2Client = void 0; | ||
exports.OAuth2Error = exports.OAuth2Fetch = exports.generateCodeVerifier = exports.OAuth2AuthorizationCodeClient = exports.OAuth2Client = void 0; | ||
var client_1 = require("./client"); | ||
@@ -8,3 +8,3 @@ Object.defineProperty(exports, "OAuth2Client", { enumerable: true, get: function () { return client_1.OAuth2Client; } }); | ||
Object.defineProperty(exports, "OAuth2AuthorizationCodeClient", { enumerable: true, get: function () { return authorization_code_1.OAuth2AuthorizationCodeClient; } }); | ||
Object.defineProperty(exports, "getCodeVerifier", { enumerable: true, get: function () { return authorization_code_1.getCodeVerifier; } }); | ||
Object.defineProperty(exports, "generateCodeVerifier", { enumerable: true, get: function () { return authorization_code_1.generateCodeVerifier; } }); | ||
var fetch_wrapper_1 = require("./fetch-wrapper"); | ||
@@ -11,0 +11,0 @@ Object.defineProperty(exports, "OAuth2Fetch", { enumerable: true, get: function () { return fetch_wrapper_1.OAuth2Fetch; } }); |
{ | ||
"name": "fetch-mw-oauth2", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Fetch middleware to add OAuth2 support", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
144950