realpython / realpython/materials

redirect_uri_mismatch http://127.0.0.1:5000/login/callback

Open
#95 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
5.2k
Forks
5.3k
Avg merge
4d 10h
Merged PRs (30d)
10

Description

I've really enjoyed the content. Found the blog re "Create a Flask Application With Google Login"
https://realpython.com/flask-google-login/

https://github.com/realpython/materials/blob/master/flask-google-login/

I got to running the app and this error.

Error: redirect_uri_mismatch
The redirect URI in the request, http://127.0.0.1:5000/login/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/310636517232-hh287vg31jbjbqe0hguc2ahmtqcrbr13.apps.googleusercontent.com?project=310636517232

I have setup nginx to redirect a domain to my flask server. Loads on a https page with a valid cert generated by certbot.
have configured my google app with my domain url.
have a working route at mydomain/login/callback

I can't see where http://127.0.0.1:5000 is set in my code. I did find old stackexchange references to setting the redirect instead of accepting the default (java examples not python).

The as published demo with redirection to localhost was working for me previously. (have deleted the previously working with localhost google app and created new google app, updated environment variables etc. exited shell, restarted ubuntu etc.

ideas?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the flask-google-login material and inspect how the OAuth callback URL is assembled from the application configuration and environment variables. Compare that value with the domain and callback URI registered for the Google OAuth client; the issue is resolved when the deployed HTTPS callback is accepted without redirect_uri_mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.