# Okta-react with react router 6 keeps the LoginCallback mounted after redirect

**URL:** <https://devforum.okta.com/t/okta-react-with-react-router-6-keeps-the-logincallback-mounted-after-redirect/21998>\
**Category:** OAuth/OIDC\
**Created:** [September 27, 2022, 1:32am UTC](https://devforum.okta.com/t/okta-react-with-react-router-6-keeps-the-logincallback-mounted-after-redirect/21998 "2022-09-27T01:32:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leesargent](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@leesargent](https://devforum.okta.com/u/leesargent)\
**Post date:** [September 27, 2022, 1:32am UTC](https://devforum.okta.com/t/okta-react-with-react-router-6-keeps-the-logincallback-mounted-after-redirect/21998/1 "2022-09-27T01:32:29Z")

</div>

I’m trying to upgrade to React Router v6. I’ve followed the guidance here [okta-react/samples/routing/react-router-dom-v6/src at master · okta/okta-react · GitHub](https://github.com/okta/okta-react/tree/master/samples/routing/react-router-dom-v6/src).  
When I’m redirected back to my domain from the okta sign-in page, my LoginCallback component stays mounted, even though the path changes to “/”. The network tab shows that I’m successfully fetching a token from `/oauth2/default/v1/token`. When I manually refresh, everything is fine and I’m authenticated and can fetch data at secure routes and everything. I cannot figure out why this is hanging in this way. I’m on:

“@okta/okta-auth-js”: “^7.0.0”,  
“@okta/okta-react”: “^6.6.0”,  
“react-router-dom”: “^6.3.0”,  
“react”: “^18.2.0”,  
“react-dom”: “^18.2.0”,

---

<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 12, 2024, 10:06pm UTC](https://devforum.okta.com/t/okta-react-with-react-router-6-keeps-the-logincallback-mounted-after-redirect/21998/2 "2024-02-12T22:06:13Z")

</div>


