Skip to content

CORS Error - /auth/me #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kasboi opened this issue May 2, 2025 · 1 comment
Open

CORS Error - /auth/me #100

kasboi opened this issue May 2, 2025 · 1 comment

Comments

@kasboi
Copy link

kasboi commented May 2, 2025

The browser returns a cors error when accessing the auth endpoints with the following message:

Access to fetch at 'https://dummyjson.com/auth/me' from origin 'https://www.test.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
@mstjr
Copy link

mstjr commented May 5, 2025

You must set credentials to false.

Why is it doing that ?

According to Mozilla Developer, the server is configured to Access-Control-Allow-Origin: *. This does not allow the credentials flag to be used.

Here's a resolution for the client side.

To correct this problem on the client side, ensure that the credentials flag's value is false when issuing your CORS request.
If using the Fetch API, make sure Request.credentials is "omit".
If the request is being issued using XMLHttpRequest, make sure you're not setting withCredentials to true.
If using Server-sent events, make sure EventSource.withCredentials is false (it's the default value).

Unfortunately, we must wait for server-side to be resolve to use this flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants