skills/auth-provider/SKILL.md
Centralized authentication provider for OAuth 2.0 and API key management. Supports Google, Binance, QuickBooks, and Slack. Provides encrypted SQLite storage, auto-refresh, PKCE flow, and health checks.
npx skillsauth add ticruz38/skills auth-providerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Foundation skill that manages OAuth tokens and API keys for all other skills in the OpenClaw ecosystem. Provides secure encrypted storage, automatic token refresh, PKCE OAuth flow, and health monitoring.
| Provider | Type | Environment Variables |
|----------|------|----------------------|
| Google | OAuth 2.0 | GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
| Binance | API Key | None (configured per-profile) |
| QuickBooks | OAuth 2.0 | QUICKBOOKS_CLIENT_ID, QUICKBOOKS_CLIENT_SECRET |
| Slack | OAuth 2.0 | SLACK_CLIENT_ID, SLACK_CLIENT_SECRET |
npm install
npm run build
Create a .env file in your OpenClaw config directory:
# ~/.openclaw/.env
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:8080/auth/callback
# QuickBooks OAuth
QUICKBOOKS_CLIENT_ID=your-quickbooks-client-id
QUICKBOOKS_CLIENT_SECRET=your-quickbooks-client-secret
QUICKBOOKS_REDIRECT_URI=http://localhost:8080/auth/callback
QUICKBOOKS_ENVIRONMENT=sandbox # or production
# Slack OAuth
SLACK_CLIENT_ID=your-slack-client-id
SLACK_CLIENT_SECRET=your-slack-client-secret
SLACK_REDIRECT_URI=http://localhost:8080/auth/callback
# Optional: Custom encryption key
AUTH_PROVIDER_KEY=your-encryption-key-min-32-chars
node dist/cli.js env-check
node dist/cli.js status
node dist/cli.js init google default
node dist/cli.js complete google <code> <state>
node dist/cli.js save-apikey binance prod \
--key YOUR_API_KEY \
--secret YOUR_API_SECRET \
--env production
# Check specific provider
node dist/cli.js health google default
# Check all providers
node dist/cli.js health
# All credentials
node dist/cli.js list
# Specific provider
node dist/cli.js list google
node dist/cli.js get google default
node dist/cli.js delete google default
import { AuthProvider, getAuthProvider } from './index';
// Create new instance
const auth = new AuthProvider({
encryptionKey: 'your-encryption-key',
dbPath: '/custom/path/credentials.db',
tokenRefreshBuffer: 300, // seconds before expiry
});
// Or use singleton
const auth = getAuthProvider();
// Step 1: Generate authorization URL
const result = auth.initiateAuth('google', 'default', [
'https://www.googleapis.com/auth/gmail.modify',
'https://www.googleapis.com/auth/calendar'
]);
console.log('Open this URL:', result.url);
// Store result.state for callback verification
// Step 2: Complete OAuth after user authorizes
const tokenData = await auth.completeAuth('google', code, state, {
email: '[email protected]'
});
// Auto-refreshes if needed
const accessToken = await auth.getValidAccessToken('google', 'default');
if (accessToken) {
// Use token with API
}
// Save API key
auth.saveApiKey(
'binance',
'prod',
'api_key_here',
'api_secret_here',
'production',
['SPOT', 'MARGIN']
);
// Get API key
const apiKey = auth.getApiKey('binance', 'prod');
// Check specific profile
const health = await auth.healthCheck('google', 'default');
console.log(health.status); // 'healthy' | 'unhealthy'
// Check all credentials
const allHealth = await auth.healthCheckAll();
// Get Binance client
const binance = auth.getBinanceClient('prod');
const accountInfo = await binance?.getAccountInfo();
// Get generic adapter
const adapter = auth.getAdapter('google');
const profile = await adapter?.getUserProfile?.(accessToken);
Credentials are stored in:
~/.openclaw/skills/auth-provider/credentials.db
Database tables:
tokens - OAuth access/refresh tokensapi_keys - API key credentialsoauth_states - Temporary OAuth state for PKCE flowAll sensitive data is AES-256 encrypted.
interface TokenData {
provider: 'google' | 'binance' | 'quickbooks' | 'slack';
profile: string;
access_token: string;
refresh_token?: string;
expires_at?: number;
scope?: string;
metadata?: Record<string, any>;
}
interface ApiKeyData {
provider: ProviderType;
profile: string;
api_key: string;
api_secret: string;
environment: 'production' | 'sandbox' | 'testnet';
permissions?: string[];
}
interface HealthCheckResult {
status: 'healthy' | 'unhealthy';
provider: ProviderType;
profile: string;
message?: string;
expires_at?: number;
scopes?: string[];
}
openid, email, profile - Basic profile infohttps://www.googleapis.com/auth/gmail.modify - Gmail accesshttps://www.googleapis.com/auth/calendar - Calendar accesshttps://www.googleapis.com/auth/drive - Drive accesshttps://www.googleapis.com/auth/spreadsheets - Sheets accesscom.intuit.quickbooks.accounting - Full accounting accesschat:write - Post messageschat:write.public - Post to public channelsusers:read - Read user infoteam:read - Read team infofiles:write - Upload fileschannels:read, groups:read - Read channel infoAUTH_PROVIDER_KEY is not set, a random key is generatedAll methods throw descriptive errors:
try {
await auth.completeAuth('google', code, state);
} catch (error) {
if (error.message.includes('Invalid or expired state')) {
// State expired, restart OAuth flow
}
}
# Type checking
npm run typecheck
# Build
npm run build
# Run CLI
npm run cli -- status
testing
Suggest recipes based on dietary preferences, available ingredients, and cuisine preferences
development
Extract data from receipt photos using Google Vision API
business
QuickBooks Online integration for accounting sync - sync customers, invoices, and transactions with two-way sync and conflict resolution
testing
QuickBooks OAuth adapter for QuickBooks Online accounting integration. Built on top of auth-provider for secure token management with automatic refresh, multi-profile support, sandbox/production toggle, and health checks.