react-oauth2-code-pkce
Advanced tools
Comparing version 1.13.5 to 1.14.0
@@ -10,3 +10,3 @@ "use strict"; | ||
// Set default values for internal config object | ||
const { autoLogin = true, clearURL = true, decodeToken = true, scope = '', preLogin = () => null, postLogin = () => null, onRefreshTokenExpire = undefined, storage = 'local', } = passedConfig; | ||
const { autoLogin = true, clearURL = true, decodeToken = true, scope = undefined, preLogin = () => null, postLogin = () => null, onRefreshTokenExpire = undefined, storage = 'local', } = passedConfig; | ||
const config = Object.assign(Object.assign({}, passedConfig), { autoLogin: autoLogin, clearURL: clearURL, decodeToken: decodeToken, scope: scope, preLogin: preLogin, postLogin: postLogin, onRefreshTokenExpire: onRefreshTokenExpire, storage: storage }); | ||
@@ -13,0 +13,0 @@ validateConfig(config); |
@@ -25,3 +25,6 @@ "use strict"; | ||
// Set query parameters and redirect user to OAuth2 authentication endpoint | ||
const params = new URLSearchParams(Object.assign({ response_type: 'code', client_id: config.clientId, scope: config.scope, redirect_uri: config.redirectUri, code_challenge: codeChallenge, code_challenge_method: 'S256' }, config.extraAuthParameters)); | ||
const params = new URLSearchParams(Object.assign({ response_type: 'code', client_id: config.clientId, redirect_uri: config.redirectUri, code_challenge: codeChallenge, code_challenge_method: 'S256' }, config.extraAuthParameters)); | ||
if (config.scope !== undefined) { | ||
params.append('scope', config.scope); | ||
} | ||
sessionStorage.removeItem(stateStorageKey); | ||
@@ -72,3 +75,3 @@ const state = customState !== null && customState !== void 0 ? customState : config.state; | ||
} | ||
const tokenRequest = Object.assign(Object.assign({ grant_type: 'authorization_code', code: authCode, scope: config.scope, client_id: config.clientId, redirect_uri: config.redirectUri, code_verifier: codeVerifier }, config.extraAuthParams), config.extraTokenParameters); | ||
const tokenRequest = Object.assign(Object.assign({ grant_type: 'authorization_code', code: authCode, scope: config.scope, client_id: config.clientId, redirect_uri: config.redirectUri, code_verifier: codeVerifier }, config.extraTokenParameters), config.extraAuthParams); | ||
return postTokenRequest(config.tokenEndpoint, tokenRequest); | ||
@@ -79,9 +82,3 @@ }; | ||
const { config, refreshToken } = props; | ||
const refreshRequest = { | ||
grant_type: 'refresh_token', | ||
refresh_token: refreshToken, | ||
scope: config.scope, | ||
client_id: config.clientId, | ||
redirect_uri: config.redirectUri, | ||
}; | ||
const refreshRequest = Object.assign({ grant_type: 'refresh_token', refresh_token: refreshToken, scope: config.scope, client_id: config.clientId, redirect_uri: config.redirectUri }, config.extraTokenParameters); | ||
return postTokenRequest(config.tokenEndpoint, refreshRequest); | ||
@@ -88,0 +85,0 @@ }; |
@@ -21,3 +21,3 @@ "use strict"; | ||
console.error(e); | ||
throw Error('Failed to decode the access token.\n\tIs it a proper Java Web Token?\n\t' + | ||
throw Error('Failed to decode the access token.\n\tIs it a proper JSON Web Token?\n\t' + | ||
"You can disable JWT decoding by setting the 'decodeToken' value to 'false' the configuration."); | ||
@@ -24,0 +24,0 @@ } |
import { ReactNode } from 'react'; | ||
interface TTokenRqBase { | ||
grant_type: string; | ||
scope: string; | ||
scope?: string; | ||
client_id: string; | ||
@@ -82,3 +82,3 @@ redirect_uri: string; | ||
redirectUri: string; | ||
scope: string; | ||
scope?: string; | ||
state?: string; | ||
@@ -85,0 +85,0 @@ logoutEndpoint?: string; |
{ | ||
"name": "react-oauth2-code-pkce", | ||
"version": "1.13.5", | ||
"version": "1.14.0", | ||
"description": "Provider agnostic react package for OAuth2 Authorization Code flow with PKCE", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
45679
748