Hello all, this is my first time posting. I've got read a bunch of article already but I'm still stuck. The problem was about the OAuth redirect_uri.
Upon investigation, when my Appwrite server instance sends OAuth to providers, instead of sending "HTTPS", it sends "HTTP" as protocol for the redirect_url.
My Appwrite instance is running inside my self-hosted server and served via Cloudflare tunnel. I already tried applying host rewrite on my apache configuration but without any luck.
I've attached the screenshots for reference.
Thanks,
is your apache forwarding to HTTPS?
Hi Steven, yes, it is. This is my apache config currently:
ServerAdmin admin@coffeeandpaste.co
ServerName appwrite.coffeeandpaste.co
ProxyPreserveHost On
ProxyPass / http://localhost:5003/
ProxyPassReverse / http://localhost:5003/
RewriteEngine On
RewriteCond %{HTTP_HOST} !^appwrite\.coffeeandpaste\.co$ [NC]
RewriteRule ^(.*)$ https://appwrite.coffeeandpaste.co$1 [R=301,L]
</VirtualHost>```
Is the endpoint of when you're creating the GitHub OAuth 2 is HTTP or HTTPS?
it's HTTPS, I just copied the callback URL provided from the Appwrite console portal
I mean where you running the createOAuth2Session('github')
Your frontend
ah yes from my frontend
which is serving locally as of the moment
That's fine but as I saw through the code if this endpoint is not https then the redirects won't be https either So, Create another tunnel to the front end, and give it a try I think it will solve it
Thanks @Binyamin , I'll try to deploy the frontend to my server and see if it works
hi @Binyamin , it's still the same, here's the URL of the frontend: https://angular.coffeeandpaste.co/
It gives me an errro
The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application
You need to add or change so the https://angular.coffeeandpaste.co/ would be the webapp url
your ProxyPass is to http:// rather than https:// 🧐
Yes @Steven is correct (oc)
The AppWrite engine get the request
protocol as http
Hi Steven, I'm ProxyPassing the Appwrite instance served on the docker-compose inside my server, that's why it's http://localhost... Maybe I'll check if I can also forward the origin protocol and use it on the proxy. I'll update this post later. Thanks for all your help 😄
it would be best to proxy to HTTPS.
See: https://github.com/appwrite/appwrite/discussions/4056#discussioncomment-3784116
Hi Steven and byawitz, using "http" instead of "https" on the OAuth's callback URL works. Also adding success URL on createOAuth2Session() made things work as expected.
Thank you very much!
👍
Recommended threads
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...