# Okta PKCE Page Refreshed Multiple times

**URL:** <https://devforum.okta.com/t/okta-pkce-page-refreshed-multiple-times/18170>\
**Category:** Questions\
**Created:** [November 22, 2021, 7:07am UTC](https://devforum.okta.com/t/okta-pkce-page-refreshed-multiple-times/18170 "2021-11-22T07:07:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tahir](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tahir/32/3503_2.png) [@Tahir](https://devforum.okta.com/u/Tahir)\
**Post date:** [November 22, 2021, 7:07am UTC](https://devforum.okta.com/t/okta-pkce-page-refreshed-multiple-times/18170/1 "2021-11-22T07:07:54Z")

</div>

Description: We are using OKTA SSO login in one of our application. We are using the below package.  
“@okta/okta-auth-js”: “^5.5.0”,  
“@okta/okta-react”: “^6.2.0”,

We are using PKCE mode for SPA.

The issue here is each time we send a request there is a delay of 10-12 second consistently on each mentioned below call.  
Below are the sequence of each calls.

[https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/.well-known/openid-configuration](https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/.well-known/openid-configuration)

[https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/authorize?client\_id=0oa15y3rlg5h0oBvc4x7&code\_challenge=76sBgitOZ9jej81cd1b36L4uYkXAuaIjjERTtGLjTTg&code\_challenge\_method=S256&nonce=LKz0gMKAeA76A7fTewvRsan0lTUXcYkaRI1qARzN2K8s9B7GW65FeYKAOs04NZ1k&redirect\_uri=https%3A%2F%2Fwc-qa3-web5.wamcentral.net%2Fimplicit%2Fcallback&response\_type=code&state=B3bBEkz2ru4d1q2dUyNUoHjuNR8LgtnJOW5MAPqFER96TRWCZAHqRJu24QDcqube&scope=openid%20email%20profile](https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/authorize?client_id=0oa15y3rlg5h0oBvc4x7&code_challenge=76sBgitOZ9jej81cd1b36L4uYkXAuaIjjERTtGLjTTg&code_challenge_method=S256&nonce=LKz0gMKAeA76A7fTewvRsan0lTUXcYkaRI1qARzN2K8s9B7GW65FeYKAOs04NZ1k&redirect_uri=https%3A%2F%2Fwc-qa3-web5.wamcentral.net%2Fimplicit%2Fcallback&response_type=code&state=B3bBEkz2ru4d1q2dUyNUoHjuNR8LgtnJOW5MAPqFER96TRWCZAHqRJu24QDcqube&scope=openid%20email%20profile)

Request URL: [https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/token](https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/token)

Request URL: [https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/keys](https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/keys)

Request URL: [https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/userinfo](https://dev-490079.okta.com/oauth2/aus39le04eDAfhtFN4x7/v1/userinfo)

Can you please share the details. Below is the sample code for your reference.

```
                    const oktaAuth = new OktaAuth({
                        issuer: data.Issuer,
                        redirectUri: `${window.location.origin}/implicit/callback`,

                        clientId: data.Client_id,                     
                        tokenManager: {
                            storage: 'sessionStorage'
                        },
                        storageManager: {
                            token: {
                                storageType: 'sessionStorage',
                                storageTypes: []
                            },
                            cache: {
                                storageType: 'sessionStorage',
                                storageTypes: []
                            },
                            transaction: {
                                storageType: 'sessionStorage',
                                storageTypes: []
                            }
                        }
                    });

                    const restoreOriginalUri = async (_oktaAuth, originalUri) => {
                        debugger;

                        window.location.replace('/');
                    };

                         oktaAuth.tokenManager.on('error', function (err) {
                        if (err.errorCode === 'login_required') {
                            window.location.href = "Unauthorized";
                        }
                    });
```

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 8, 2024, 7:57pm UTC](https://devforum.okta.com/t/okta-pkce-page-refreshed-multiple-times/18170/2 "2024-02-08T19:57:47Z")

</div>


