A simple Python Flask app that performs Google OAuth 2.0 authentication and displays the token response (access token, refresh token, etc.).
- Python 3.8+
- A Google Cloud project with OAuth 2.0 credentials
- Go to Google Cloud Console
- Create a project (or select an existing one)
- Navigate to APIs & Services > Credentials
- Create an OAuth 2.0 Client ID (Application type: Web application)
- Add
http://localhost:8080/callbackas an Authorized redirect URI - Enable any APIs required by your scopes (e.g., Google Business Profile API)
git clone <repo-url>
cd google-authenticator
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate a .env file in the project root:
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_SCOPE=email,profile,https://www.googleapis.com/auth/plus.business.manage
GOOGLE_ACCESS_TYPE=offline
source venv/bin/activate
python app.pyOpen http://localhost:8080 in your browser. You will be redirected to Google's consent screen. After granting access, the callback page displays the full JSON token response from Google, including:
access_tokenrefresh_token(only on first consent or whenprompt=consentis set)expires_intoken_typescopeid_token
├── .env # OAuth credentials (not committed)
├── .gitignore
├── app.py # Flask app with OAuth flow
├── requirements.txt # Python dependencies
├── CLAUDE.md # Notes for Claude Code
└── README.md