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,
Summary
The user's Appwrite instance is sending HTTP instead of HTTPS in the redirect URL for OAuth. They tried using "http" instead of "https" and adding a success URL, but it didn't work. There are suggestions to proxy to HTTPS and to ensure that the ProxyPass is set to https:// instead of http://. The user is advised to check the endpoint where they are creating the GitHub OAuth 2 and to deploy the frontend to their server. The user's Apache configuration is shared, and it is confirmed that the Apache is forwarding to HTTPS. There is no solution provided in the thread.
Drake
Admin
Mar 17, 2023, 19:11
is your apache forwarding to HTTPS?
nero125
Rank 1: Thread
Mar 17, 2023, 19:17
Hi Steven, yes, it is. This is my apache config currently:
Is the endpoint of when you're creating the GitHub OAuth 2 is HTTP or HTTPS?
nero125
Rank 1: Thread
Mar 17, 2023, 19:22
it's HTTPS, I just copied the callback URL provided from the Appwrite console portal
nero125
Rank 1: Thread
Mar 17, 2023, 19:22
Binyamin
Rank 7: Quantum Computer
Mar 17, 2023, 19:22
I mean where you running the createOAuth2Session('github')
Your frontend
nero125
Rank 1: Thread
Mar 17, 2023, 19:23
ah yes from my frontend
nero125
Rank 1: Thread
Mar 17, 2023, 19:23
which is serving locally as of the moment
Binyamin
Rank 7: Quantum Computer
Mar 17, 2023, 19:25
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
nero125
Rank 1: Thread
Mar 17, 2023, 19:26
Thanks @Binyamin , I'll try to deploy the frontend to my server and see if it works
your ProxyPass is to http:// rather than https:// 🧐
Binyamin
Rank 7: Quantum Computer
Mar 17, 2023, 19:36
Yes @Steven is correct (oc)
The AppWrite engine get the request protocol as http
nero125
Rank 1: Thread
Mar 17, 2023, 19:41
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 😄
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.