I am setting up a technical blog with the following infrastructure:
Client <---domain.tld:80---> Nginx Reverse Proxy <---localhost:8001---> Docker container with Django web app
I am using Gunicorn as WSGI web server within my container.
The problem I am facing is that when I want to include Google authentication for my comment section and call my corresponding URI for authentication (which is http://domain.tld/auth/login/google-oauth2/), I get the following error from google:
The redirect URI in the request, http://localhost:8001/auth/complete/google-oauth2/, does not match the ones authorized for the OAuth client.
So the main problem is that google thinks I want the redirect host to be localhost, because my app is deployed on localhost (and only served via my reverse proxy to the internet), but of course I need it to be domain.tld instead.
I didn't found an option were I can explicitly tell google were the traffic should be redirected to, I only can authorize URIs.
Of course I tried to allow localhost redirect access, but obviously this doesn't help because google redirects to the localhost URI.
My code is mainly based on this blog post and this stackoverflow question.
As this is mainly a link call to a URL from my server, I think my code shouldn't be that useful at all.
I am thankful for any helpful feedback!