Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit f5b6995

Browse files
authored
Merge pull request #3 from niklasthiem1/fix/get-code-verifier-in-token-function
fix: move getCodeVerifier() to token function to forward potential errors
2 parents 6be3cd8 + f5e68c6 commit f5b6995

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ export class AuthorizationCodeCallback extends BaseOAuthClientComponent {
7676
render() {
7777
const { oauthClient, ...props } = this.props;
7878

79-
// Obtain the generated and stored code verifier for PKCE
80-
const codeVerifier = getCodeVerifier();
81-
8279
// obtain required options for OauthReceiver
8380
const options = {
8481
...props,
@@ -90,6 +87,8 @@ export class AuthorizationCodeCallback extends BaseOAuthClientComponent {
9087
tokenFn:
9188
props.tokenFn ||
9289
function () {
90+
// Obtain the generated and stored code verifier for PKCE
91+
const codeVerifier = getCodeVerifier();
9392
return oauthClient.code
9493
.getToken(document.location.href, {
9594
body: { code_verifier: codeVerifier },

0 commit comments

Comments
 (0)