Connecting to Gmail using 3-Legged OAuth 2.0
This process allows our application to securely connect to your Gmail account so we can read, send, or organize emails on your behalf without ever seeing your password.
Phase 1: Google Cloud Console Setup
https://mail.google.com/
https:// [YOUR_ODC_TENANT] /GmailExplorer/LandingScreen
Phase 2: The 3-Legged OAuth FlowLeg 1: Redirect User to Google
The app constructs a URL and redirects you to Google's authorization server.
https://accounts.google.com/o/oauth2/v2/auth
client_id
redirect_uri
response_type=code
access_type=offline
prompt=consent
Leg 2: Handle the Callback
After you consent, Google redirects you back to the app with a temporary code.
https:// [YOUR_ODC_TENANT] GmailExplorer/LandingScreen?code=4/0Afge...&scope=...
Leg 3: Exchange Code for Tokens
The server securely exchanges that temporary code for usable tokens.
https://oauth2.googleapis.com/token
Phase 3: Making API Requests
The app can now use the Access Token to securely call the Gmail API.
GET https://gmail.googleapis.com/gmail/v1/users/me/messages Authorization: Bearer [YOUR_ACCESS_TOKEN]