Having trouble following Okta Auth JS and React guide

Hi,

I have a simple React SPA which I want to protect and am trying out Okta so this is my first time using it. It’s also pretty much my first react App too so please forgive me if I’m doing something stupid!

I’m following the guide here - https://developer.okta.com/code/react/okta_react/ to get started and all the way through I am using the functional components.

My issue is the that when my App runs, I get redirected to /login and the page just says ‘Loading…’. I do get a very brief flash of the form elements but almost imediately it changes to ‘Loading…’ with no login form.

This happens if I just go to / or if I try to go to /protected.

I’ve followed the guide twice to the letter and both times I get the same issue. Can anyone advise on what might be going wrong?

If you look in your browser’s developer console, do you see an error?

Hi @mraible, no there’s nothing in the console at all. As a test I console.logged out the authState in Home.jsx. When I visit http://localhost:3000 I am getting 2 console logs from Home.jsx which display as:

Is that any use in diagnosing this?

Hello,

were you able to resolve the issue i am also facing similar situation




image
basically auth state is not updating after
authService.redirect({ sessionToken });
in Login.js

Thank you

@d12santosh No, sadly not yet, hoping someone here can shed some light on the issue!

If you create a new app with Create React App and use OktaDev Schematics to integrate Okta, does it work?