react-oauth2-code-pkce
Advanced tools
Comparing version 1.2.2-a to 1.2.2-b
@@ -61,3 +61,2 @@ "use strict"; | ||
.catch(function (error) { | ||
console.log(error); | ||
setError(error); | ||
@@ -70,8 +69,5 @@ if ((0, authentication_1.errorMessageForExpiredRefreshToken)(error)) { | ||
} | ||
else { // The client still has a valid token | ||
setTokenData((0, authentication_1.decodeToken)(token)); | ||
} | ||
} | ||
else { // No refresh_token | ||
console.error("Tried to refresh token without a refresh token. Clearing state..."); | ||
console.error("Tried to refresh token without a refresh token."); | ||
setError('Bad authorization state. Refreshing the page might solve the issue.'); | ||
@@ -106,3 +102,2 @@ } | ||
.catch(function (error) { | ||
console.error(error); | ||
setError(error); | ||
@@ -109,0 +104,0 @@ }); |
@@ -71,2 +71,20 @@ "use strict"; | ||
exports.login = login; | ||
function postWithFormData(tokenEndpoint, formData) { | ||
return fetch(tokenEndpoint, { | ||
method: 'POST', | ||
body: formData, | ||
}) | ||
.then(function (response) { return response.json() | ||
.then(function (body) { | ||
if (!response.ok) { | ||
console.error(body.error_description); | ||
throw body.error_description; | ||
} | ||
return body; | ||
}); }) | ||
.catch(function (error) { | ||
console.error(error); | ||
throw (error === null || error === void 0 ? void 0 : error.message) || error; | ||
}); | ||
} | ||
var fetchTokens = function (authConfig) { | ||
@@ -94,13 +112,3 @@ /* | ||
formData.append('code_verifier', codeVerifier); | ||
return fetch(authConfig.tokenEndpoint, { | ||
method: 'POST', | ||
body: formData, | ||
}) | ||
.then(function (response) { return response.json().then(function (body) { | ||
if (!response.ok) { | ||
console.error(body.error_description); | ||
throw body.error_description; | ||
} | ||
return body; | ||
}); }); | ||
return postWithFormData(authConfig.tokenEndpoint, formData); | ||
}; | ||
@@ -116,13 +124,3 @@ exports.fetchTokens = fetchTokens; | ||
formData.append('redirect_uri', authConfig.redirectUri); | ||
return fetch(authConfig.tokenEndpoint, { | ||
method: 'POST', | ||
body: formData, | ||
}) | ||
.then(function (response) { return response.json().then(function (body) { | ||
if (!response.ok) { | ||
console.error(body.error_description); | ||
throw body.error_description; | ||
} | ||
return body; | ||
}); }); | ||
return postWithFormData(authConfig.tokenEndpoint, formData); | ||
}; | ||
@@ -129,0 +127,0 @@ exports.fetchWithRefreshToken = fetchWithRefreshToken; |
{ | ||
"name": "react-oauth2-code-pkce", | ||
"version": "1.2.2a", | ||
"version": "1.2.2b", | ||
"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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
2
26108
471