Add complete OAuth token refresh and sync solution
- Setup wizard with auto-detection of OpenClaw paths and Claude CLI - Token sync watcher (inotifywait) for real-time credential updates - Auto-refresh trigger timer that runs Claude CLI every 30 min - Supports Claude CLI in Docker container or on host - Temporary ANTHROPIC_BASE_URL override for container environments - Anthropic model configuration for OpenClaw - Auth profile management (fixes key vs access field) - Systemd services and timers for both sync and trigger - Comprehensive documentation and troubleshooting guides - Re-authentication notification system Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
templates/oauth.json.template
Normal file
10
templates/oauth.json.template
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"anthropic": {
|
||||
"access": "sk-ant-oat01-YOUR_ACCESS_TOKEN_HERE",
|
||||
"refresh": "sk-ant-ort01-YOUR_REFRESH_TOKEN_HERE",
|
||||
"expires": 1772120060006,
|
||||
"scopes": ["user:inference", "user:mcp_servers", "user:profile", "user:sessions:claude_code"],
|
||||
"subscriptionType": "max",
|
||||
"rateLimitTier": "default_claude_max_5x"
|
||||
}
|
||||
}
|
||||
9
templates/refresh-claude-token.service
Normal file
9
templates/refresh-claude-token.service
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Refresh Claude OAuth Token (one-shot)
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=@@REFRESH_SCRIPT_PATH@@
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=refresh-claude-token
|
||||
10
templates/refresh-claude-token.timer
Normal file
10
templates/refresh-claude-token.timer
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Refresh Claude OAuth Token every 6 hours
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5min
|
||||
OnUnitActiveSec=6h
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
16
templates/sync-oauth-token.service
Normal file
16
templates/sync-oauth-token.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Sync Claude OAuth Token to OpenClaw
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=@@SYNC_SCRIPT_PATH@@
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=sync-oauth-token
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
13
templates/trigger-claude-refresh.service
Normal file
13
templates/trigger-claude-refresh.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Trigger Claude CLI OAuth token refresh
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=@@TRIGGER_SCRIPT_PATH@@
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
10
templates/trigger-claude-refresh.timer
Normal file
10
templates/trigger-claude-refresh.timer
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Trigger Claude CLI OAuth token refresh every 30 minutes
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5min
|
||||
OnUnitActiveSec=30min
|
||||
AccuracySec=1min
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user