Prerequisites
- A Google account
- ollim-bot installed and running
- A web browser accessible from the machine running ollim-bot (the OAuth flow opens a browser window)
Create a Google Cloud project
Go to the Google Cloud Console
and create a new project (or select an existing one).
- Click the project dropdown at the top of the page
- Click New Project
- Enter a name (e.g.
ollim-bot) and click Create
Enable the required APIs
Navigate to APIs & Services > Library and enable these three APIs:
Search for each API by name and click Enable.
| API | Used for |
|---|---|
| Google Tasks API | Task management — list, create, complete, delete |
| Google Calendar API | Event management — list, create, show, delete |
| Gmail API | Read-only email access — list unread, read, search |
Configure the OAuth consent screen
Navigate to APIs & Services > OAuth consent screen.
- Select External as the user type and click Create
- Fill in the required fields (app name, user support email, developer email)
- On the Scopes page, click Add or Remove Scopes and add:
https://www.googleapis.com/auth/taskshttps://www.googleapis.com/auth/calendar.eventshttps://www.googleapis.com/auth/gmail.readonly
- On the Test users page, add your Google account email
For personal use, the project can stay in “Testing” mode — no verification needed.
Only accounts listed as test users can complete the OAuth flow.
Create OAuth client credentials
Navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID
- Select Desktop application as the application type
- Give it a name (e.g.
ollim-bot) - Click Create
- Click Download JSON to download the credentials file
credentials.json
Save credentials to the data directory
Move the downloaded file to ollim-bot looks for credentials at this exact path:If the file is missing when a Google API call is made, the bot exits with:
~/.ollim-bot/state/credentials.json:Complete the first authentication flow
Start the bot (or trigger any Google integration feature):On the first Google API call, ollim-bot:
- Reads
~/.ollim-bot/state/credentials.json - Starts a local HTTP server on
127.0.0.1(random port) - Opens your browser to Google’s OAuth consent page
- After you grant access, captures the authorization code
- Exchanges the code for access and refresh tokens
- Saves the tokens to
~/.ollim-bot/state/token.json
Token lifecycle
ollim-bot manages tokens automatically throughget_credentials()
in google/auth.py:
| Scenario | Behavior |
|---|---|
token.json exists, token valid | Used immediately — no network call |
token.json exists, token expired | Refreshed via the refresh token, token.json updated |
token.json missing | Full OAuth flow — opens browser for consent |
credentials.json missing | Exits with an error message |
~/.ollim-bot/state/token.json stores the access token,
refresh token, and granted scopes. Do not edit it manually.
Adding or changing scopes
The OAuth scopes are defined ingoogle/auth.py:
- Add the scope string to the
SCOPESlist - Delete
~/.ollim-bot/state/token.json - Restart the bot — the OAuth consent flow runs again with the updated scopes
Existing tokens do not automatically gain new scopes.
You must delete
token.json and re-consent whenever scopes change.