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
- Sudden CORS Errors - Domain hasn't Chang...
I have an Appwrite project with two web apps configured, the first one has the hostname `*` and the second one I just added to test if it could fix the issue wi...
- User ID case sensitivity
I see that through REST (and SDK as well), getting a user is not case sensitive. And even though documentation does not clearly state that it is, the wording "V...
- Any way to temporarily bypass the email ...
Hey guys, any way to bypass the email verification to use the accounts again? i need to recover some projects that due to recent changes have been stopped, and ...