Back

[SOLVED] CORS issue with my ReactJS Application

  • 0
  • Web
wizard23
2 Nov, 2023, 02:52

Nope, it's the correct one.

TL;DR
There was a CORS issue with a ReactJS application, but it has been solved. Sometimes restarting the dev server or adding a prefix can fix the issue. The problem turned out to be with local variables and their import in a file. The user was unable to sign up and saw a 401 Unauthorized error after hardcoding the variables. It was discovered that the project was undefined and the URL was set to localhost with a port. The user was asked to provide request headers and a screenshot of the added web platform. They were also asked to switch to the network tab and share the request and response headers for the API call. The issue is
wizard23
2 Nov, 2023, 02:53

I checked everything. This is really weird.

Drake
2 Nov, 2023, 02:56

Would you please switch to the network tab and share the request and response headers for the API call?

Drake
2 Nov, 2023, 02:56

Please also share the url of this page

Drake
2 Nov, 2023, 02:57

Please also share a screenshot of what you added for the web platform

Drake
2 Nov, 2023, 02:57

And....why did you redact the local url?

wizard23
2 Nov, 2023, 03:12
wizard23
2 Nov, 2023, 03:12
wizard23
2 Nov, 2023, 03:14
Drake
2 Nov, 2023, 03:16

All request headers please

Drake
2 Nov, 2023, 03:16

What's the URL of this page?

wizard23
2 Nov, 2023, 03:16

URL it's my localhost with a port

Drake
2 Nov, 2023, 03:18

The project is undefined

wizard23
2 Nov, 2023, 03:21

I hardcoded it, and now I get 401 Unathorized

Drake
2 Nov, 2023, 03:22

That would be expected if you haven't logged in yet

wizard23
2 Nov, 2023, 03:22
wizard23
2 Nov, 2023, 03:22

ok - let me try to sign up

Drake
2 Nov, 2023, 03:24

Yes, this is expected

wizard23
2 Nov, 2023, 03:24

Thanks so much Steven.

wizard23
2 Nov, 2023, 03:24

Something is messed up with my local variables and importing it in my file. I was readu to sign up and see it on the back-end.

wizard23
2 Nov, 2023, 03:24

You're the man.

wizard23
2 Nov, 2023, 03:25
Drake
2 Nov, 2023, 03:26

Sometimes you need to restart your dev server for the vars to take affect. Other times, you need to make sure to have some sort of prefix to pass the variable to the app

Drake
2 Nov, 2023, 03:26
Drake
2 Nov, 2023, 03:26

[SOLVED] CORS issue with my ReactJS Application

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more