CORS on gotrue-js login when working with Netlify Dev

netlify site name: lyvetool.netlify.app

I am using gotrue-js to login a user, while running netlify locally with netlify dev

I have tried this configurations, none of them work:

  auth = new GoTrue({
      APIUrl: 'https://lyvetool.netlify.app/.netlify/identity',
      audience: '',
      setCookie: false,
  });

fails with CORS.

and

  auth = new GoTrue({
      APIUrl: 'http://localhost:8888/.netlify/identity',
      audience: '',
      setCookie: false,
  });

fails with 404.

Is there a way of testing netlify’s identity locally with netlify dev?

The best solution I found until now is running chrome with:

google-chrome --disable-web-security --user-data-dir=.test-google-chrome/

Hi @Niklison, welcome to the community!

Yea, typically, I would say there wouldn’t be an easy way to test Identity locally but your workaround/solution will work. You’d just want to make sure not to use that instance of Chrome to browser anywhere except your localhost due to the lower security.

Let me know how that goes!

1 Like