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!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.