Okta react stuck at /login/callback

Hi,
after returning from Okta hosted login, my react SPA remains at localhost:3000/login/callback.

I expect it to redirect to localhost:3000/. Am I right here?

Also, in the console I get the following errors:

  1. Failed to load resource: the server responded with a status of 400 ()
    And
  2. okta-auth-js.umd.js?8c47:361 Uncaught (in promise) AuthApiError

Please help.

Thanks in advance :slight_smile:

Make sure your app is assigned to your user, or the Everyone group.

1 Like

Thanks for the reply.
Yes, it is assigned to the user. Still this issue persists.
I am working on a local setup. I have enabled CORS from okta dashboard.

Am I facing the issue due to CORS?

Do you see a CORS error in the console? For which endpoint?

I am getting this error:
Failed to load resource: the server responded with a status of 400 () .
and upon clicking on https://dev-________.okta.com/oauth2/default/v1/token

I get
{
“errorCode”: “E0000022”,
“errorSummary”: “The endpoint does not support the provided HTTP method”,
“errorLink”: “E0000022”,
“errorId”: “oaeVlZiMr54Q0uh7JsMVzaIKg”,
“errorCauses”:
}

I had encountered the same problem. The problem is you might have not added your “http://localhost:3000” URL into the trusted origins.
Login to your admin account, go to Security>API>Trusted Origins , there you will find Add Origin button. Click on it and add your URL “http://localhost:3000” and assign it a name, just tick mark the two checkboxes below and Save.
After doing this you will be able to redirect to your page.

1 Like

Hi Akshay,

I have enabled trusted login:

Hi Sagar,

As in above screenshot, did you check the checkboxes ?
Even after doing so if you are facing problem just share me your console window from browser.

FIXED!

after adding the trusted origin url, I got the following error:

{“error”:“server_error”,“error_description”:“The ‘sub’ system claim could not be evaluated.”}

I found this link OAuth error when using Okta Authentication in ionic app - authentication
So, I added the username in the username attribute and it worked!

Thanks for your help everyone!