This is an app to understand how to configure Google OIDC for login. This is built using Python and Flask using AuthLib.
Install the required dependencies:
$ pip install -U Flask Authlib requests
- Create a Google Developer Account if you don't already have one.
- Create a new Google Project
- Configure the OAuth Consent Screen:
- In the Cloud Console, go to APIs & Services > OAuth consent screen.
- Choose "External" and click "Create".
- Fill out the form with required details (e.g., App name, User support email).
- Add scopes
email
,openid
andprofile
. - Save and continue.
- Create your Google OAuth Credentials:
- In the Cloud Console, go to APIs & Services > Credentials.
- Click "Create Credentials" and select "OAuth 2.0 Client ID".
- Select "Web application".
- Enter a name for the credential.
- Under "Authorized redirect URIs", add the URI where Google will redirect after the user authenticates, in this case
http://127.0.0.1:5000/authorize
- Save Your Client ID and Client Secret.
Fill the given client ID and secret into config.py
.
Start server with:
$ export FLASK_APP=app.py
$ flask run
Then visit:
http://127.0.0.1:5000/