Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 1.13 KB

readme.md

File metadata and controls

17 lines (12 loc) · 1.13 KB

Google Hosted Authentication Example in Flask

Goal: demo how to use Google to handle user authentication (authN) for a demo flask web app.

To run this app, run cmd: docker-compose build and then docker-compose up (make sure to install Docker locally first!)

Credit: https://www.youtube.com/watch?v=FKgJEfrhU1E - Code Specialist (https://code-specialist.com)

To set this up with your (service's) Google account:

  • https://console.cloud.google.com/
  • Register a service with Google > create a new project (name it).
  • Within the new project, go to APIs + Services > Create credentials > Configure Consent Screen > External Users > name the project again (same name is ok) > enter user support email > leave defaults > create test users if you'd like
  • Go back to dashboard > Credentials > Create Creds > OAuth Client ID > web app > define your redirect url of your web app (http://localhost/callback)
  • Create the call back > download your creds as a json file
  • Copy this client_secret.json locally to the project repo
  • Update the GOOGLE_CLIENT_ID in main.py with what's present in the client_secret.json you got from Google.