Best use case
google-auth is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Google OAuth setup, refresh tokens
Teams using google-auth should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/google-auth/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How google-auth Compares
| Feature / Agent | google-auth | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Google OAuth setup, refresh tokens
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Infra Google Auth
> Google OAuth setup, refresh tokens, troubleshooting
## When to use
- "Google API is not working"
- "401 Unauthorized"
- "token expired"
- Setting up a new project
## Paths
| What | Path |
|------|------|
| Credentials | `$GOOGLE_TOOLS_PATH/credentials.json` |
| Token | `$GOOGLE_TOOLS_PATH/token.json` |
## Scopes (permissions)
```python
SCOPES = [
'https://www.googleapis.com/auth/gmail.send',
'https://www.googleapis.com/auth/gmail.readonly',
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/documents',
'https://www.googleapis.com/auth/drive',
]
```
## How to use existing token
```python
import json
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
with open('$GOOGLE_TOOLS_PATH/token.json', 'r') as f:
token_data = json.load(f)
creds = Credentials(
token=token_data.get('token'),
refresh_token=token_data.get('refresh_token'),
token_uri=token_data.get('token_uri'),
client_id=token_data.get('client_id'),
client_secret=token_data.get('client_secret')
)
# Gmail
gmail = build('gmail', 'v1', credentials=creds)
# Sheets
sheets = build('sheets', 'v4', credentials=creds)
# Drive
drive = build('drive', 'v3', credentials=creds)
```
## Refresh token manually
```python
from google.auth.transport.requests import Request
if creds.expired and creds.refresh_token:
creds.refresh(Request())
# Save the updated token
with open('$GOOGLE_TOOLS_PATH/token.json', 'w') as f:
json.dump({
'token': creds.token,
'refresh_token': creds.refresh_token,
'token_uri': creds.token_uri,
'client_id': creds.client_id,
'client_secret': creds.client_secret,
}, f)
```
## Create a new token (if the old one doesn't work)
```python
from google_auth_oauthlib.flow import InstalledAppFlow
SCOPES = [...] # all required scopes
flow = InstalledAppFlow.from_client_secrets_file(
'$GOOGLE_TOOLS_PATH/credentials.json',
SCOPES
)
creds = flow.run_local_server(port=0)
# Save
with open('$GOOGLE_TOOLS_PATH/token.json', 'w') as f:
json.dump({
'token': creds.token,
'refresh_token': creds.refresh_token,
'token_uri': creds.token_uri,
'client_id': creds.client_id,
'client_secret': creds.client_secret,
}, f)
```
## Common API calls
### Reading Sheets
```python
result = sheets.spreadsheets().values().get(
spreadsheetId='SPREADSHEET_ID',
range="'Sheet Name'!A1:Z100"
).execute()
rows = result.get('values', [])
```
### Writing to Sheets
```python
sheets.spreadsheets().values().update(
spreadsheetId='SPREADSHEET_ID',
range="'Sheet Name'!A1",
valueInputOption='RAW',
body={'values': [['value1', 'value2']]}
).execute()
```
### Sending Email
```python
import base64
from email.mime.text import MIMEText
message = MIMEText('Body text', 'plain', 'utf-8')
message['to'] = 'recipient@email.com'
message['from'] = 'Your Name <your@email.com>'
message['subject'] = 'Subject'
raw = base64.urlsafe_b64encode(message.as_bytes()).decode()
gmail.users().messages().send(userId='me', body={'raw': raw}).execute()
```
## Troubleshooting
| Problem | Solution |
|---------|----------|
| 401 Unauthorized | Refresh token or create a new one |
| invalid_grant | Token revoked, create a new one |
| Scope mismatch | Load token without scope verification |
| RefreshError | Create a new token via OAuth flow |
## Account
- Email: `your@email.com`
- Type: Google Workspace
## Related skills
- `email-send-direct` -- single email via Gmail API
- `email-send-bulk` -- bulk email via Gmail API
- `telegram-send` -- reads Sheets for dataRelated Skills
googlesheets-automation
Automate Google Sheets operations (read, write, format, filter, manage spreadsheets) via Rube MCP (Composio). Read/write data, manage tabs, apply formatting, and search rows programmatically.
google-drive
Upload files, create folders, list and search Google Drive via CLI
google-drive-automation
Automate Google Drive file operations (upload, download, search, share, organize) via Rube MCP (Composio). Upload/download files, manage folders, share with permissions, and search across drives programmatically.
google-calendar-automation
Automate Google Calendar events, scheduling, availability checks, and attendee management via Rube MCP (Composio). Create events, find free slots, manage attendees, and list calendars programmatically.
google-analytics
Analyze Google Analytics data, review website performance metrics, identify traffic patterns, and suggest data-driven improvements. Use when the user asks about analytics, website metrics, traffic analysis, conversion rates, user behavior, or performance optimization.
google-analytics-automation
Automate Google Analytics tasks via Rube MCP (Composio): run reports, list accounts/properties, funnels, pivots, key events. Always search tools first for current schemas.
google-ads
Query, audit, and optimize Google Ads campaigns. Supports two modes: (1) API mode for bulk operations with google-ads Python SDK, (2) Browser automation mode for users without API access - just attach a browser tab to ads.google.com. Use when asked to check ad performance, pause campaigns/keywords, find wasted spend, audit conversion tracking, or optimize Google Ads accounts.
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
auth-system
Implement secure authentication and authorization systems with JWT, OAuth2, Session-based auth, and RBAC. Use when: (1) implementing user login/signup, (2) setting up JWT tokens, (3) OAuth2 integration (Google, GitHub, etc.), (4) role-based access control (RBAC), (5) password hashing and validation, (6) session management, (7) API authentication middleware, (8) 2FA/MFA setup. Triggers: "authentication", "login", "JWT", "OAuth", "session", "password hash", "RBAC", "permissions", "2FA".
auth-manager
网页登录态管理。使用 OpenClaw 内置 browser (profile=openclaw) 统一管理各平台登录状态,定期检查可用性。
wemp-operator
> 微信公众号全功能运营——草稿/发布/评论/用户/素材/群发/统计/菜单/二维码 API 封装
zsxq-smart-publish
Publish and manage content on 知识星球 (zsxq.com). Supports talk posts, Q&A, long articles, file sharing, digest/bookmark, homework tasks, and tag management. Use when publishing content to 知识星球, creating/editing posts, uploading files/images/audio, managing digests, batch publishing, or formatting content for 知识星球.