Back

[SOLVED] Getting error on Google signin in production

  • 1
  • Users
  • Web
Drake
20 Mar, 2023, 04:05

Btw, to format multi line code, use 3 back ticks. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

TL;DR
Issue: Getting error on Google signin in production. Solution: It seems that the provided success or failure URL is not trusted by Appwrite. Add the domain as a web platform to your project. Also, ensure that any reverse proxy in front of Appwrite is forwarding to it using HTTPS. Another option is to disable HTTP support completely. If the redirect URI mismatch error occurs, make sure the hostname is the domain name of your app and add it as a web platform to your project. If using a dynamic URL, check the documentation for proper formatting. Use three backticks for multi-line code formatting.
Drake
20 Mar, 2023, 04:05

What exactly is window.location.origin again?

shofol
20 Mar, 2023, 04:08

I am redirecting to adminlogin page after google sign in process. Let's say- I am calling this from localhost. So the redirect url will be -http://localhost/adminlogin?fromRedirectSuccess=true and when I'm trying from https://peapp.elufasys.com, the redirect url will be- https://peapp.elufasys.com/adminlogin?fromRedirectSuccess=true

shofol
20 Mar, 2023, 04:08

I wanted to keep it dynamic rather than placing a static url

Drake
20 Mar, 2023, 04:10

So did you add that hostname as a web platform to your project? See https://appwrite.io/docs/getting-started-for-web#addPlatform

shofol
20 Mar, 2023, 04:14

This is the request I'm sending.

shofol
20 Mar, 2023, 04:14

Hostname is the server ip right now

Drake
20 Mar, 2023, 04:15

That doesn't sound right...the hostname should be the domain name of your app

shofol
20 Mar, 2023, 04:16

The client app or the appwrite production instance?

Drake
20 Mar, 2023, 04:16

Client app

shofol
20 Mar, 2023, 04:19

Ok, now it is going to google sign in page but giving redirect uri mismatch error. It's saying the redirect uri is-

Request details: redirect_uri=http://appwrite.elufasys.com/v1/account/sessions/oauth2/callback/google/64158b3ada94714c7ab9

But, I have added https redirect uri in the console.

safwan
20 Mar, 2023, 04:21

this is probably because of your webserver configuration

safwan
20 Mar, 2023, 04:21

I had the same issue where it kept redirecting to http instead of https

safwan
20 Mar, 2023, 04:21

I fixed it by disabling http support completely

safwan
20 Mar, 2023, 04:21

Maybe there's a cleaner fix, but this fix is what I did for development.

safwan
20 Mar, 2023, 04:23

where are you hosting your appwrite?

shofol
20 Mar, 2023, 04:23

Oh Man! I am noob at the server side. Any other options? If not, what should I tell the developer who is maintaining the server?

shofol
20 Mar, 2023, 04:24
Drake
20 Mar, 2023, 04:26

If there's a reverse proxy in front of Appwrite, make sure it's forwarding to Appwrite using https

safwan
20 Mar, 2023, 04:26

this

safwan
20 Mar, 2023, 04:26

tell this to your developer

shofol
20 Mar, 2023, 04:26

Ok, thanks. I will let you know if it's gets fixed.

Meldiron
20 Mar, 2023, 09:36

Looks like you provided success or failure URL (when running createOAuthSession) to a domain that Appwrite does not trust. Can you check what domain you provided there? If you add such a domain as web platform to your project, the problem should be gone.

shofol
22 Mar, 2023, 09:17

@Steven , @safwan , it worked. Thanks

Drake
22 Mar, 2023, 15:05

[SOLVED] Getting error on Google signin in production

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