Login issue with okta

Hi, im using Okta on my React application to login,the issue that i have is that okta authenticates correctly but it doesnt take me to the corresponding landing page,it redirects me to the login page again

Im using index.js to add my okta code and config.js to add my okta details to login in

INDEX.JS

CONFIG.JS
image

I would be very grateful if you could help me

Hello Rebeca!

Your code looks good based on our React samples, so I would suggest checking your protected route - it looks like it’s redirecting to /auth/Login, is that the correct route for your sign-in page that you keep looping back to? Can we change that to where you want to land?

1 Like

Hi, i just did, the correct landing page is suppose to be “admin/dashboard”
but when i change it the URL gets into a loop and it changes between “/admin/dashboard” and “/login/callback” after okta authentication

You may want to compare against our sample here: samples-js-react/App.jsx at master · okta/samples-js-react · GitHub

Specifically, what happens if we remove the “Redirect to=” line? It sounds like it’s redirecting after the protected route already prompts you to log in successfully, and that line’s not in the sample above. Does this work if you try it?

1 Like