Skip to content
Back

Google Auth Issue

  • 0
  • Users
  • Accounts
  • Web
  • Cloud
Kushl121
2 Jan, 2024, 08:37

So, google authentication works in localhost, but not in the deployment.

code:

TypeScript
async createAuthSession(provider) {
  const currentDomain = process.env.NEXT_PUBLIC_WEBSITE_URL;
  this.account.createOAuth2Session(provider, `${currentDomain}/profile`, `${currentDomain}/auth`);
}

environment variable: NEXT_PUBLIC_WEBSITE_URL=(website name)

in google cloud console: Authorised Javascript Origins:

Authorized redirect URIs (I'm aware that we don't need to add so many URIs)

error i receive is mentioned in the image as well, but adding it here too:

Error 400 Invalid success param: URL host must be one of: localhost, cloud.appwrite.io, *

Type

general_argument_invalid

it works splendidly in localhost, but not in deployment!

TL;DR
The user is experiencing an issue with Google authentication not working in deployment but working in localhost. They have already added the necessary settings in the Google Cloud Console and provided code snippets. They receive an error message mentioning an invalid success param with a URL host not being one of the allowed options. Solution: Check and ensure that the website hostname is added correctly in the web app settings of the Google Cloud Console.
RohitRanjan
2 Jan, 2024, 08:54

Try adding a hostname in the web app settings

Kushl121
2 Jan, 2024, 13:59

I've used * here. It should work logically. But I'll try adding the name of the website

Kushl121
2 Jan, 2024, 14:08

Hey man. Thank you for replying first of all. And yeah, it works now. Both in development and production mode

ideclon
2 Jan, 2024, 16:02

It doesn’t seem to work for the OAuth response URLs

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