Overview
The Google resources use OAuth2 with a refresh token to authenticate against:- Google Drive API v3 - lists documents, reads metadata
- Google Docs API v1 - reads/writes document content
client_id, client_secret, and refresh_token.
Setup
1. Create a Google Cloud Project
- Go to https://console.cloud.google.com/
- Click the project selector dropdown -> New Project
- Name it (e.g., “Mirage”) -> Create
- Select it from the dropdown
2. Enable APIs
- Go to https://console.cloud.google.com/apis/library
- Search Google Drive API -> click -> Enable
- Search Google Docs API -> click -> Enable
3. Configure Google Auth Platform
The OAuth settings are under Google Auth Platform in the Cloud Console left sidebar (or go to https://console.cloud.google.com/auth/overview). A) Branding (left sidebar):- Fill in: App name (e.g., “Mirage”), support email, developer contact email
- Save
- Set user type to External
- Add your own Google email as a test user
- Save
- Click Add or Remove Scopes
- Search for or paste these scopes:
https://www.googleapis.com/auth/drive(full Drive access)https://www.googleapis.com/auth/documents(Google Docs)https://www.googleapis.com/auth/presentations(Google Slides)
- Select them -> Save
- Go to Audience -> click Publish App
- See Token Lifetime for details
4. Create OAuth2 Client
- Go to Clients in the left sidebar (or click Create OAuth client on the Overview page)
- Application type: Desktop app
- Name it -> Create
- Copy the Client ID and Client Secret
5. Get the Refresh Token
A) Open this URL in a browser (replaceYOUR_CLIENT_ID):
access_type=offline- required to receive a refresh tokenprompt=consent- forces refresh token issuance on re-auth
http://localhost:1?code=4/0AXXXX... (page won’t load - expected). Copy the code value from the URL bar.
D) Exchange for tokens:
refresh_token - save it.
6. Set Environment Variables
Token Lifetime
To publish: go to the OAuth consent screen page and click Publish App. Users will see an “unverified app” warning during auth, which is fine for personal use.
A published refresh token only gets revoked if:
- Manually revoked at https://myaccount.google.com/permissions
- Google account password is changed
- Token unused for 6 months
- 100+ outstanding refresh tokens per account per client (oldest revoked)
TokenManager in the resource automatically uses the refresh token to obtain fresh access tokens (which expire hourly) behind the scenes.
Scopes Reference
Troubleshooting
For Python configuration, see the Python Google Workspace Setup guide.