Back

redirect_uri_mismatch in Google OAuth2

  • 0
  • Self Hosted
Vu Le
26 Jul, 2024, 18:11

Hi all. I'm hosting my appwrite on my own VPS but I', having trouble creating a session for an authenticated user via gmail. When I run the appwrite endpoint with http (http://localhost:80/v1), and have my web client running on http://localhost:3000, I can create a new user. However, when I put a domain and encrypts with https, the app keeps redirecting to http instead of https (http://af23-116-101-10-209 as above). I tried both nginx, and ngrok and neither works.

I tried setting _APP_OPTIONS_FORCE_HTTPS=enabled but I have no idea what the endpoint will be? I tried curl https:localhost:443 and others but it doesn't work

TL;DR
Issue: Developer encountering redirect_uri_mismatch in Google OAuth2 when trying to authenticate a user via Gmail on their VPS-hosted Appwrite setup. When running appwrite with HTTP, user creation works, but when adding a domain and HTTPS, the app redirects back to HTTP. Attempted solutions like setting `_APP_OPTIONS_FORCE_HTTPS=enabled` but unsure of the correct endpoint. Solution: The developer should set the redirect URIs in the Google OAuth2 credentials to include both HTTP and HTTPS versions to resolve the redirect_uri_mismatch issue. Also, the `_APP_OPTIONS_FORCE_HTTPS` may need additional configurations for the correct endpoint.
Vu Le
26 Jul, 2024, 18:12

here's the output for docker ps

Vu Le
26 Jul, 2024, 18:16

when I tried curling https://locahost. For more information, I executed the docker-php-entrypoint container, and I can see the console on localhost:80 (inside the container)

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