Bot Uptime
OAUTH 2.1 + PKCE SPECIFICATION

Bot Uptime OAuth 2.1 Integration

Let users securely authorize third-party tools, desktop IDEs, and AI assistants (Claude, ChatGPT, Cursor, VS Code, Windsurf) to manage their Bot Uptime containers — without ever copying raw API keys.

STEP 1

Discover & Register

Read /.well-known/oauth-authorization-server and dynamically register a client via POST /oauth/register (RFC 7591).

STEP 2

Consent with PKCE S256

Redirect the user to /oauth/authorize with a SHA-256 code_challenge. The user approves exact scopes on a clean consent screen.

STEP 3

Exchange & Call API

Exchange the one-time authorization code + code_verifier at POST /oauth/token for a Bearer access token & refresh token.

1. OAuth & MCP Metadata Discovery

Bot Uptime implements both RFC 8414 (Authorization Server Metadata) and RFC 9728 (Protected Resource Metadata) so MCP clients auto-discover endpoints with zero manual configuration:

GET /.well-known/oauth-authorization-server

Returns issuer, authorization_endpoint, token_endpoint, registration_endpoint, supported scopes, and code_challenge_methods_supported: ["S256"].

GET /.well-known/oauth-protected-resource/api/mcp

Points MCP clients at https://botuptime.net/api/mcp and advertises https://botuptime.net as the trusted Authorization Server.

POST /oauth/register RFC 7591

Register an OAuth client programmatically. Allowed redirect URI schemes: https://, http://localhost / 127.0.0.1, cursor://, vscode://, claude://, and windsurf://.

cURL Registration Request
curl -X POST https://botuptime.net/oauth/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "My Bot Automation Tool",
    "redirect_uris": ["http://localhost:8765/callback"]
  }'
GET /oauth/authorize PKCE S256 Required

Open this URL in the user’s browser. Plaintext PKCE is rejected — only code_challenge_method=S256 is accepted.

Authorization URL
https://botuptime.net/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Fcallback&scope=read+write+power+deploy&state=RANDOM_CSRF_STATE&code_challenge=BASE64URL_SHA256_VERIFIER&code_challenge_method=S256
POST /oauth/token authorization_code · refresh_token

Exchange the single-use authorization code (valid 5 minutes) and original PKCE code_verifier for a Bearer token. Access tokens are valid for 30 days and can be refreshed seamlessly via grant_type=refresh_token.

Token Exchange (JSON or form-urlencoded)
curl -X POST https://botuptime.net/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "authorization_code",
    "client_id": "YOUR_CLIENT_ID",
    "code": "RETURNED_AUTH_CODE",
    "redirect_uri": "http://localhost:8765/callback",
    "code_verifier": "YOUR_ORIGINAL_RANDOM_VERIFIER"
  }'

Supported Scopes & Instant Revocation

Available scopes: readwritepowerdeploy

Users can view every connected OAuth app, inspect its activity log, and revoke its access token immediately from Dashboard → AI Agents. All tokens are stored strictly as SHA-256 hashes — Bot Uptime never stores plaintext access or refresh tokens in SQLite.