supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

CORS error from HTTPS website

Open TannerGabriel opened this issue 5 years ago • 2 comments

Bug report

Describe the bug

Everything in my application works fine when running locally, but once I host the application using HTTPS, I cannot send Authentication requests to Supabase.

Access to XMLHttpRequest at 'https://DOMAIN.supabase.co//auth/v1/token?grant_type=password' from origin 'https://control.DOMAIN' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Is there any parameter I need to add to the SupabaseJs instance to make this possible?

To Reproduce

  1. Creat Supabase online application
  2. Enable authentication
  3. Implement authentication inside of your application
  4. Host application using HTTPS

Expected behavior

Requests should work on HTTPS websites and not return a CORS error.

System information

  • OS: [PopOS, Windows 11]
  • Browser [Brave, Chrome]
  • Version of supabase-js: [1.22.5]
  • Version of Node.js: [e.g. 16.10.0]

TannerGabriel avatar Nov 26 '21 17:11 TannerGabriel

Hi, this looks like an issue specific to your project. Please create an issue at https://app.supabase.io/support/new if you are still experiencing the issue

inian avatar Jan 03 '22 15:01 inian

I had the same issue, check your environment variables, and compare them on local and server. In my case, I had put an extra letter in the VPS .env file, when I copied the key. So, when I was going to authenticate I got the cors error. It may be useful for someone

TomasDmArg avatar Jun 26 '22 19:06 TomasDmArg