Search code examples
google-apigoogle-oauthgoogle-signin

Google Sign In Testing on localhost: issue with oAuth consent screen authorised domains


I'm trying to sign in with Google on localhost without success. I've set up the authorized javascript origins as expected (API&Services > Credentials)...

authorised javascript origins

...but after signing in, I still get this error:

the error message after signing in

You can see Google mentions that the Authorised Javascript origins are automatically added to the OAuth consent screen as authorised domains. So, I checked the OAuth consent screen and I don't see localhost:

OAuth consent screen authorised domains

... and I cannot add localhost in the Authorized domains list cause it requires a top-level domain.


Solution

  • I just switched to https using mkcert on my Svelte front and it worked. See details here: run sveltekit dev with https