OAuth Framework
PocketPaw includes a built-in OAuth 2.0 framework that handles authentication with Google and Spotify services.
Supported Providers
| Provider | Services | Flow |
|---|---|---|
| Gmail, Calendar, Drive, Docs | Authorization code | |
| Spotify | Search, playback, playlists | Authorization code |
How It Works
- First use: When a tool requires OAuth (e.g., Gmail), PocketPaw checks for stored tokens
- No token: Opens a browser for the OAuth consent flow
- Authorization: User grants permissions
- Token storage: Tokens are saved to
~/.pocketclaw/tokens/ - Refresh: Expired tokens are automatically refreshed
Configuration
Google OAuth
export POCKETCLAW_GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"export POCKETCLAW_GOOGLE_CLIENT_SECRET="your-client-secret"Create OAuth credentials at console.cloud.google.com:
- Go to APIs & Services → Credentials
- Create Credentials → OAuth client ID
- Application type: Desktop app
- Download the JSON
Spotify OAuth
export POCKETCLAW_SPOTIFY_CLIENT_ID="your-spotify-client-id"export POCKETCLAW_SPOTIFY_CLIENT_SECRET="your-spotify-secret"Create an app at developer.spotify.com:
- Create a new app
- Set redirect URI to
http://localhost:8888/callback - Copy the Client ID and Secret
Token Storage
Tokens are stored in ~/.pocketclaw/tokens/:
~/.pocketclaw/tokens/├── google_token.json└── spotify_token.jsonTokens include refresh tokens, so re-authorization is only needed if tokens are revoked.
Dashboard Integration
The web dashboard provides a visual OAuth flow. When configuring Google or Spotify in the Settings panel, clicking “Authorize” opens the consent screen and automatically stores the tokens.
Security
- Tokens are stored with restricted file permissions (600)
- Client secrets are stored in the config file, not in tokens
- The security audit CLI checks token storage permissions
Was this page helpful?