react-oauth2-code-pkce
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -87,6 +87,6 @@ "use strict"; | ||
setRefreshToken(response.refresh_token); | ||
setTokenExpire((0, timeUtils_1.epochAtSecondsFromNow)(response.expires_in || FALLBACK_EXPIRE_TIME)); | ||
setTokenExpire((0, timeUtils_1.epochAtSecondsFromNow)(response.expires_in ?? FALLBACK_EXPIRE_TIME)); | ||
// If there is no refresh_token_expire, use access_token_expire + 10min. | ||
// If no access_token_expire, assume double the fallback expire time | ||
let refreshTokenExpire = response.refresh_token_expires_in || 2 * FALLBACK_EXPIRE_TIME; | ||
let refreshTokenExpire = response.refresh_token_expires_in ?? 2 * FALLBACK_EXPIRE_TIME; | ||
if (!response.refresh_token_expires_in && response.expires_in) { | ||
@@ -112,6 +112,9 @@ refreshTokenExpire = response.expires_in + FALLBACK_EXPIRE_TIME; | ||
.catch((error) => { | ||
setError(error); | ||
if ((0, authentication_1.errorMessageForExpiredRefreshToken)(error)) { | ||
logOut(); | ||
(0, authentication_1.redirectToLogin)(config); | ||
console.error(error); | ||
setError(error.message); | ||
if (initial) | ||
login(); // If the attempt to get a new token failed during page load, do a full login. | ||
if ((0, authentication_1.errorMessageForExpiredRefreshToken)(error.message)) { | ||
if (onRefreshTokenExpire) | ||
onRefreshTokenExpire({ login }); | ||
} | ||
@@ -118,0 +121,0 @@ }); |
{ | ||
"name": "react-oauth2-code-pkce", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "Plug-and-play 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
31780
595