Browser-based OAuth flow using Anthropic's hosted callback. Users authorize on claude.ai, paste the code back, and tokens are encrypted and stored in D1. Includes auto-refresh, Bearer auth via custom fetch wrapper, and mcp_ tool name prefixing required by the OAuth endpoint. Also fixes provider-config save bug that required encryption key unconditionally — now only checks when API key is present.
9 lines
290 B
SQL
9 lines
290 B
SQL
CREATE TABLE `anthropic_oauth_tokens` (
|
|
`user_id` text PRIMARY KEY NOT NULL,
|
|
`access_token` text NOT NULL,
|
|
`refresh_token` text NOT NULL,
|
|
`expires_at` text NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|