Replaced NextAuth's built-in OAuth provider (incompatible with Cloudflare Workers) with custom OAuth implementation using native fetch API. Features: - Custom OAuth flow compatible with Cloudflare Workers edge runtime - Auto-provisions users from Nextcloud based on group membership - Group-based role assignment (artists, shop_admins, admins) - Auto-creates artist profiles for users in 'artists' group - Seamless integration with existing NextAuth session management Technical changes: - Added custom OAuth routes: /api/auth/nextcloud/authorize & callback - Created Nextcloud API client for user provisioning (lib/nextcloud-client.ts) - Extended credentials provider to accept Nextcloud one-time tokens - Added user management functions to database layer - Updated signin UI to use custom OAuth flow - Added environment variables for OAuth configuration Documentation: - Comprehensive setup guide in docs/NEXTCLOUD-OAUTH-SETUP.md - Updated CLAUDE.md with new authentication architecture Fixes: NextAuth OAuth incompatibility with Cloudflare Workers (unenv https.request error) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.2 KiB
TOML
53 lines
1.2 KiB
TOML
name = "united-tattoo"
|
|
account_id = "5cee6a21cea282a9c89d5297964402e7"
|
|
compatibility_date = "2024-09-23"
|
|
compatibility_flags = ["nodejs_compat"]
|
|
main = ".open-next/worker.js"
|
|
|
|
[vars]
|
|
MIGRATE_TOKEN = "ut_migrate_20251006_rotated_1a2b3c"
|
|
NEXTAUTH_URL = "https://united-tattoos.com"
|
|
NODE_ENV = "production"
|
|
|
|
[assets]
|
|
directory = ".open-next/assets"
|
|
binding = "ASSETS"
|
|
|
|
# D1 Database binding
|
|
[[d1_databases]]
|
|
binding = "DB"
|
|
database_name = "united-tattoo"
|
|
database_id = "7191a4c4-e3b2-49c6-bd8d-9cc3394977ec"
|
|
migrations_dir = "sql/migrations_up"
|
|
|
|
# R2 bucket binding
|
|
[[r2_buckets]]
|
|
binding = "R2_BUCKET"
|
|
bucket_name = "united-tattoo"
|
|
|
|
# R2 bucket for OpenNext incremental cache
|
|
[[r2_buckets]]
|
|
binding = "NEXT_INC_CACHE_R2_BUCKET"
|
|
bucket_name = "united-tattoo-inc-cache"
|
|
|
|
[[services]]
|
|
binding = "WORKER_SELF_REFERENCE"
|
|
service = "united-tattoo"
|
|
|
|
# Environment variables for production
|
|
[env.production.vars]
|
|
NEXTAUTH_URL = "https://united-tattoos.com"
|
|
NODE_ENV = "production"
|
|
MIGRATE_TOKEN = "ut_migrate_20251006_rotated_1a2b3c"
|
|
|
|
# Environment variables for preview
|
|
[env.preview.vars]
|
|
NEXTAUTH_URL = "https://united-tattoos.com"
|
|
NODE_ENV = "production"
|
|
MIGRATE_TOKEN = "ut_migrate_20251006_rotated_1a2b3c"
|
|
|
|
[dev]
|
|
ip = "0.0.0.0"
|
|
port = 8897
|
|
local_protocol = "http"
|