Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(platform): replace Supabase Auth with Better Auth (#13330)

Nicholas Tindle994598b43ebf
diff --git a/.github/workflows/claude-dependabot.yml b/.github/workflows/claude-dependabot.yml
index 184c4852b0..d20cc75d6d 100644
--- a/.github/workflows/claude-dependabot.yml
+++ b/.github/workflows/claude-dependabot.yml
@@ -132,11 +132,7 @@ jobs:
"rabbitmq:management"
"clamav/clamav-debian:latest"
"busybox:latest"
- "kong:2.8.1"
- "supabase/gotrue:v2.170.0"
- "supabase/postgres:15.8.1.049"
- "supabase/postgres-meta:v0.86.1"
- "supabase/studio:20250224-d10db0f"
+ "pgvector/pgvector:pg15"
)
# Check if any cached tar files exist (more reliable than cache-hit)
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
index db8c47f897..964a3687c0 100644
--- a/.github/workflows/claude.yml
+++ b/.github/workflows/claude.yml
@@ -145,11 +145,7 @@ jobs:
"rabbitmq:management"
"clamav/clamav-debian:latest"
"busybox:latest"
- "kong:2.8.1"
- "supabase/gotrue:v2.170.0"
- "supabase/postgres:15.8.1.049"
- "supabase/postgres-meta:v0.86.1"
- "supabase/studio:20250224-d10db0f"
+ "pgvector/pgvector:pg15"
)
# Check if any cached tar files exist (more reliable than cache-hit)
diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml
index f5d82495a0..9e43118569 100644
--- a/.github/workflows/copilot-setup-steps.yml
+++ b/.github/workflows/copilot-setup-steps.yml
@@ -152,11 +152,7 @@ jobs:
"rabbitmq:management"
"clamav/clamav-debian:latest"
"busybox:latest"
- "kong:2.8.1"
- "supabase/gotrue:v2.170.0"
- "supabase/postgres:15.8.1.049"
- "supabase/postgres-meta:v0.86.1"
- "supabase/studio:20250224-d10db0f"
+ "pgvector/pgvector:pg15"
)
# Check if any cached tar files exist (more reliable than cache-hit)
diff --git a/.github/workflows/platform-backend-ci.yml b/.github/workflows/platform-backend-ci.yml
index db05f79b4a..138a451448 100644
--- a/.github/workflows/platform-backend-ci.yml
+++ b/.github/workflows/platform-backend-ci.yml
@@ -64,6 +64,50 @@ jobs:
CI: true
PLAIN_OUTPUT: True
+ # autogpt_libs is a standalone package with its own env; the backend `test`
+ # job (scoped to autogpt_platform/backend) never collects its tests, so run
+ # them here. Pure unit tests — no database or external services needed.
+ autogpt-libs-test:
+ permissions:
+ contents: read
+ timeout-minutes: 10
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ working-directory: autogpt_platform/autogpt_libs
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+
+ - name: Set up Python 3.12
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+
+ - name: Set up Python dependency cache
+ uses: actions/cache@v5
+ with:
+ path: ~/.cache/pypoetry
+ key: poetry-${{ runner.os }}-py3.12-libs-${{ hashFiles('autogpt_platform/autogpt_libs/poetry.lock') }}
+
+ - name: Install Poetry
+ run: |
+ HEAD_POETRY_VERSION=$(python ../../.github/workflows/scripts/get_package_version_from_lockfile.py poetry ../backend/poetry.lock)
+ echo "Using Poetry version ${HEAD_POETRY_VERSION}"
+ curl -sSL https://install.python-poetry.org | POETRY_VERSION=$HEAD_POETRY_VERSION python3 -
+
+ - name: Install Python dependencies
+ run: poetry install
+
+ - name: Run pytest
+ run: poetry run pytest -q
+
+ env:
+ CI: true
+ PLAIN_OUTPUT: True
+
type-check:
permissions:
contents: read
@@ -210,10 +254,9 @@ jobs:
# picks the right published port per shard.
#
# Not reusing docker-compose.platform.yml directly because compose
- # validates the full file even when only some services are ``up``,
- # and that file references services (db/kong/...) defined in a
- # sibling compose file — pulling both in would needlessly couple
- # CI to the full local-dev stack.
+ # validates the full file even when only some services are ``up``
+ # — pulling it in would needlessly couple CI to the full
+ # local-dev stack.
docker network create redis-cluster-ci
for i in 0 1 2; do
port=$((17000 + i))
@@ -260,11 +303,6 @@ jobs:
docker exec redis-0 redis-cli -p 17000 cluster info >&2 || true
exit 1
- - name: Setup Supabase
- uses: supabase/setup-cli@v1
- with:
- version: 1.178.1
-
- id: get_date
name: Get date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
@@ -318,15 +356,28 @@ jobs:
- name: Generate Prisma Client
run: poetry run prisma generate && poetry run gen-prisma-stub
- - id: supabase
- name: Start Supabase
- working-directory: .
+ - name: Start Postgres
+ working-directory: autogpt_platform
run: |
- supabase init
- supabase start --exclude postgres-meta,realtime,storage-api,imgproxy,inbucket,studio,edge-runtime,logflare,vector,supavisor
- supabase status -o env | sed 's/="/=/; s/"$//' >> $GITHUB_OUTPUT
- # outputs:
- # DB_URL, API_URL, GRAPHQL_URL, ANON_KEY, SERVICE_ROLE_KEY, JWT_SECRET
+ # Plain pgvector Postgres; the init script creates the legacy
+ # `auth` schema shim that historical migrations reference.
+ docker run -d --name postgres-test \
+ -e POSTGRES_USER=postgres \
+ -e POSTGRES_PASSWORD=postgres \
+ -e POSTGRES_DB=postgres \
+ -p 5432:5432 \
+ -v "$(pwd)/db/init/00-init.sql:/docker-entrypoint-initdb.d/00-init.sql:ro" \
+ pgvector/pgvector:pg15
+ for _ in $(seq 1 30); do
+ if docker exec postgres-test pg_isready -U postgres >/dev/null 2>&1; then
+ echo "Postgres ready"
+ exit 0
+ fi
+ sleep 1
+ done
+ echo "Postgres failed to start" >&2
+ docker logs postgres-test >&2
+ exit 1
- name: Wait for ClamAV to be ready
run: |
@@ -360,8 +411,8 @@ jobs:
- name: Run Database Migrations
run: poetry run prisma migrate deploy
env:
- DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }}
- DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }}
+ DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
+ DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
- name: Run pytest with coverage
run: |
@@ -374,11 +425,9 @@ jobs:
fi
env:
LOG_LEVEL: ${{ runner.debug && 'DEBUG' || 'INFO' }}
- DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }}
- DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }}
- SUPABASE_URL: ${{ steps.supabase.outputs.API_URL }}
- SUPABASE_SERVICE_ROLE_KEY: ${{ steps.supabase.outputs.SERVICE_ROLE_KEY }}
- JWT_VERIFY_KEY: ${{ steps.supabase.outputs.JWT_SECRET }}
+ DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
+ DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
+ JWT_VERIFY_KEY: "ci-only-jwt-verify-key-with-at-least-32-characters" # DO NOT USE IN PRODUCTION!!
REDIS_HOST: "localhost"
REDIS_PORT: "17000"
ENCRYPTION_KEY: "dvziYgz0KSK8FENhju0ZYi8-fRTfAdlz6YLhdB_jhNw=" # DO NOT USE IN PRODUCTION!!
diff --git a/.github/workflows/platform-fullstack-ci.yml b/.github/workflows/platform-fullstack-ci.yml
index c29412b2e1..79419ef515 100644
--- a/.github/workflows/platform-fullstack-ci.yml
+++ b/.github/workflows/platform-fullstack-ci.yml
@@ -156,7 +156,7 @@ jobs:
with:
submodules: recursive
- - name: Set up Platform - Copy default supabase .env
+ - name: Set up Platform - Copy default platform .env
run: |
cp ../.env.default ../.env
@@ -214,15 +214,13 @@ jobs:
uses: actions/cache@v5
with:
path: /tmp/e2e_test_data.sql
- key: e2e-test-data-${{ hashFiles('autogpt_platform/backend/test/e2e_test_data.py', 'autogpt_platform/backend/migrations/**', '.github/workflows/platform-fullstack-ci.yml') }}
+ key: e2e-test-data-${{ hashFiles('autogpt_platform/backend/test/e2e_test_data.py', 'autogpt_platform/backend/backend/data/user.py', 'autogpt_platform/backend/migrations/**', '.github/workflows/platform-fullstack-ci.yml') }}
- - name: Set up Platform - Start Supabase DB + Auth
+ - name: Set up Platform - Start database
run: |
- docker compose -f ../docker-compose.resolved.yml up -d db auth --no-build
+ docker compose -f ../docker-compose.resolved.yml up -d db --no-build
echo "Waiting for database to be ready..."
timeout 60 sh -c 'until docker compose -f ../docker-compose.resolved.yml exec -T db pg_isready -U postgres 2>/dev/null; do sleep 2; done'
- echo "Waiting for auth service to be ready..."
- timeout 60 sh -c 'until docker compose -f ../docker-compose.resolved.yml exec -T db psql -U postgres -d postgres -c "SELECT 1 FROM auth.users LIMIT 1" 2>/dev/null; do sleep 2; done' || echo "Auth schema check timeout, continuing..."
- name: Set up Platform - Run migrations
run: |
@@ -251,7 +249,11 @@ jobs:
run: |
docker compose -f ../docker-compose.resolved.yml up -d --no-build
echo "Waiting for rest_server to be ready..."
- timeout 60 sh -c 'until curl -f http://localhost:8006/health 2>/dev/null; do sleep 2; done' || echo "Rest server health check timeout, continuing..."
+ timeout 180 sh -c 'until curl -f http://localhost:8006/health 2>/dev/null; do sleep 2; done' || {
+ echo "❌ rest_server did not become healthy in 180s"
+ docker compose -f ../docker-compose.resolved.yml logs --tail=100 rest_server
+ exit 1
+ }
env:
NEXT_PUBLIC_PW_TEST: true
@@ -266,20 +268,16 @@ jobs:
exit 1
}
- # Dump auth.users + platform schema for cache (two separate dumps)
+ # Dump the platform schema for cache (includes the Better Auth
+ # user/session/account tables seeded by e2e_test_data.py)
echo "Dumping database for cache..."
- {
- docker compose -f ../docker-compose.resolved.yml exec -T db \
- pg_dump -U postgres --data-only --column-inserts \
- --table='auth.users' postgres
- docker compose -f ../docker-compose.resolved.yml exec -T db \
- pg_dump -U postgres --data-only --column-inserts \
- --schema=platform \
- --exclude-table='platform._prisma_migrations' \
- --exclude-table='platform.apscheduler_jobs' \
- --exclude-table='platform.apscheduler_jobs_batched_notifications' \
- postgres
- } > /tmp/e2e_test_data.sql
+ docker compose -f ../docker-compose.resolved.yml exec -T db \
+ pg_dump -U postgres --data-only --column-inserts \
+ --schema=platform \
+ --exclude-table='platform._prisma_migrations' \
+ --exclude-table='platform.apscheduler_jobs' \
+ --exclude-table='platform.apscheduler_jobs_batched_notifications' \
+ postgres > /tmp/e2e_test_data.sql
echo "✅ Database dump created for caching ($(wc -l < /tmp/e2e_test_data.sql) lines)"
diff --git a/.github/workflows/platform-supabase-auth-sweep.yml b/.github/workflows/platform-supabase-auth-sweep.yml
new file mode 100644
index 0000000000..11fa06b9ce
--- /dev/null
+++ b/.github/workflows/platform-supabase-auth-sweep.yml
@@ -0,0 +1,53 @@
+name: AutoGPT Platform - Supabase Auth Sweep
+
+# Re-runs the GoTrue -> Better Auth user copy as an idempotent sweep. The
+# bulk copy happens in Prisma migration
+# 20260716120000_copy_supabase_users_to_better_auth during the normal deploy;
+# run this once AFTER the frontend has switched to Better Auth to catch users
+# who signed up via GoTrue in between.
+
+on:
+ workflow_dispatch:
+ inputs:
+ environment:
+ description: "Environment to sweep"
+ type: choice
+ required: true
+ options:
+ - develop
+ - production
+
+permissions:
+ contents: "read"
+
+jobs:
+ sweep:
+ environment: ${{ github.event.inputs.environment }}
+ name: Sweep GoTrue users into Better Auth
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+
+ - name: Set up pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ package_json_file: autogpt_platform/frontend/package.json
+
+ - name: Set up Node
+ uses: actions/setup-node@v6
+ with:
+ node-version: "24.18.0"
+ cache: "pnpm"
+ cache-dependency-path: autogpt_platform/frontend/pnpm-lock.yaml
+
+ - name: Install dependencies
+ working-directory: ./autogpt_platform/frontend
+ run: pnpm install --frozen-lockfile
+
+ - name: Run sweep
+ working-directory: ./autogpt_platform/frontend
+ run: npx tsx scripts/migrate-supabase-auth.ts
+ env:
+ DATABASE_URL: ${{ secrets.BACKEND_DATABASE_URL }}
diff --git a/.gitignore b/.gitignore
index 8c315deece..73f3e199bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,3 +212,6 @@ test-screenshots/
.ign*
**/.ign*
.claude/scheduled_tasks.lock
+
+# Supabase CLI machine-local state (linked project ref, etc.)
+supabase/.temp/
diff --git a/SECURITY.md b/SECURITY.md
index 45705d7106..d177c7abd0 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -6,6 +6,8 @@ We take the security of our project seriously. If you believe you have found a s
> **Important Note**: Any code within the `classic/` folder is considered legacy, unsupported, and out of scope for security reports. We will not address security vulnerabilities in this deprecated code.
+> **Important Note**: The JWKS transport check (the startup warning when `JWT_JWKS_URL` is fetched over cleartext `http://` from a non-local host) is best-effort operator guidance, not a security boundary. It is a warning only, it never blocks startup, and it cannot tell a trusted private network from a hostile one. Securing the network path between the backend and the JWKS endpoint is the operator's responsibility — see the self-hosting security note in `docs/platform/getting-started.md`. Reports that the warning can be missed, silenced, or evaded are not eligible for a CVE.
+
Instead, please report them via:
- [GitHub Security Advisory](https://github.com/Significant-Gravitas/AutoGPT/security/advisories/new)
<!--- [Huntr.dev](https://huntr.com/repos/significant-gravitas/autogpt) - where you may be eligible for a bounty-->
diff --git a/autogpt_platform/.env.default b/autogpt_platform/.env.default
index bb74500874..5dc5c7a587 100644
--- a/autogpt_platform/.env.default
+++ b/autogpt_platform/.env.default
@@ -1,123 +1,15 @@
############
-# Secrets
-# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION
-############
-
-POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
-JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
-ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
-SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
-DASHBOARD_USERNAME=supabase
-DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated
-SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
-VAULT_ENC_KEY=your-encryption-key-32-chars-min
-
-
-############
-# Database - You can change these to any PostgreSQL database that has logical replication enabled.
+# Database
+# YOU MUST CHANGE THE PASSWORD BEFORE GOING INTO PRODUCTION
+#
+# These document the credentials hardcoded for the `db` service in
+# docker-compose.yml. If you change them there, also update DATABASE_URL /
+# DIRECT_URL in docker-compose.platform.yml, backend/.env(.default) and
+# frontend/.env(.default).
############
POSTGRES_HOST=db
POSTGRES_DB=postgres
POSTGRES_PORT=5432
# default user is postgres
-
-
-############
-# Supavisor -- Database pooler
-############
-POOLER_PROXY_PORT_TRANSACTION=6543
-POOLER_DEFAULT_POOL_SIZE=20
-POOLER_MAX_CLIENT_CONN=100
-POOLER_TENANT_ID=your-tenant-id
-
-
-############
-# API Proxy - Configuration for the Kong Reverse proxy.
-############
-
-KONG_HTTP_PORT=8000
-KONG_HTTPS_PORT=8443
-
-
-############
-# API - Configuration for PostgREST.
-############
-
-PGRST_DB_SCHEMAS=public,storage,graphql_public
-
-
-############
-# Auth - Configuration for the GoTrue authentication server.
-############
-
-## General
-SITE_URL=http://localhost:3000
-ADDITIONAL_REDIRECT_URLS=
-JWT_EXPIRY=3600
-DISABLE_SIGNUP=false
-API_EXTERNAL_URL=http://localhost:8000
-
-## Mailer Config
-MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"
-MAILER_URLPATHS_INVITE="/auth/v1/verify"
-MAILER_URLPATHS_RECOVERY="/auth/v1/verify"
-MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"
-
-## Email auth
-ENABLE_EMAIL_SIGNUP=true
-ENABLE_EMAIL_AUTOCONFIRM=false
-SMTP_HOST=supabase-mail
-SMTP_PORT=2500
-SMTP_USER=fake_mail_user
-SMTP_PASS=fake_mail_password
-SMTP_SENDER_NAME=fake_sender
-ENABLE_ANONYMOUS_USERS=false
-
-## Phone auth
-ENABLE_PHONE_SIGNUP=true
-ENABLE_PHONE_AUTOCONFIRM=true
-
-
-############
-# Studio - Configuration for the Dashboard
-############
-
-STUDIO_DEFAULT_ORGANIZATION=Default Organization
-STUDIO_DEFAULT_PROJECT=Default Project
-
-STUDIO_PORT=3000
-# replace if you intend to use Studio outside of localhost
-SUPABASE_PUBLIC_URL=http://localhost:8000
-
-# Enable webp support
-IMGPROXY_ENABLE_WEBP_DETECTION=true
-
-# Add your OpenAI API key to enable SQL Editor Assistant
-OPENAI_API_KEY=
-
-
-############
-# Functions - Configuration for Functions
-############
-# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.
-FUNCTIONS_VERIFY_JWT=false
-
-
-############
-# Logs - Configuration for Logflare
-# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction
-############
-
-LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key
-
-# Change vector.toml sinks to reflect this change
-LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key
-
-# Docker socket location - this value will differ depending on your OS
-DOCKER_SOCKET_LOCATION=/var/run/docker.sock
-
-# Google Cloud Project details
-GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID
-GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER
+POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
diff --git a/autogpt_platform/.gitignore b/autogpt_platform/.gitignore
index bc70dc96bc..205e83eb84 100644
--- a/autogpt_platform/.gitignore
+++ b/autogpt_platform/.gitignore
@@ -2,5 +2,10 @@
*.ign.*
.application.logs
+# Local Postgres data (db service bind mount)
+data/db/data
+# Pre-rename location; still on disk for anyone who booted the old layout
+volumes/db/data
+
# Claude Code local settings only — the rest of .claude/ is shared (skills etc.)
.claude/settings.local.json
diff --git a/autogpt_platform/Makefile b/autogpt_platform/Makefile
index d53be570bc..f69251fe30 100644
--- a/autogpt_platform/Makefile
+++ b/autogpt_platform/Makefile
@@ -1,6 +1,6 @@
.PHONY: start-core stop-core logs-core format lint migrate run-backend run-frontend load-store-agents
-# Run just Supabase + Redis + RabbitMQ
+# Run just Postgres + Redis + RabbitMQ
start-core:
docker compose up -d deps
@@ -10,7 +10,7 @@ stop-core:
reset-db:
docker compose stop db
- rm -rf db/docker/volumes/db/data
+ rm -rf data/db/data
cd backend && poetry run prisma migrate deploy
cd backend && poetry run prisma generate
cd backend && poetry run gen-prisma-stub
@@ -52,7 +52,7 @@ load-store-agents:
help:
@echo "Usage: make <target>"
@echo "Targets:"
- @echo " start-core - Start just the core services (Supabase, Redis, RabbitMQ) in background"
+ @echo " start-core - Start just the core services (Postgres, Redis, RabbitMQ) in background"
@echo " stop-core - Stop the core services"
@echo " reset-db - Reset the database by deleting the volume"
@echo " logs-core - Tail the logs for core services"
diff --git a/autogpt_platform/README.md b/autogpt_platform/README.md
index 5e6e9837ef..70b2156ff4 100644
--- a/autogpt_platform/README.md
+++ b/autogpt_platform/README.md
@@ -46,7 +46,7 @@ You can now run the following to enable just the core services.
# For help
make help
-# Run just Supabase + Redis + RabbitMQ
+# Run just Postgres + Redis + RabbitMQ
make start-core
# Stop core services
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/__init__.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/__init__.py
index ce0ae68a13..00ce68dbe4 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/__init__.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/__init__.py
@@ -16,6 +16,7 @@ from .permissions import (
check_org_permission,
check_team_permission,
)
+from .service import requires_frontend_service
__all__ = [
"verify_settings",
@@ -26,6 +27,7 @@ __all__ = [
"get_request_context",
"requires_org_permission",
"requires_team_permission",
+ "requires_frontend_service",
"add_auth_responses_to_openapi",
"User",
"RequestContext",
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py
index 7a6e7287f4..5d205f0df9 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config.py
@@ -1,5 +1,6 @@
import logging
import os
+from urllib.parse import urlparse
from jwt.algorithms import get_default_algorithms, has_crypto
@@ -16,7 +17,8 @@ ALGO_RECOMMENDATION = (
"We highly recommend using an asymmetric algorithm such as ES256, "
"because when leaked, a shared secret would allow anyone to "
"forge valid tokens and impersonate users. "
- "More info: https://supabase.com/docs/guides/auth/signing-keys#choosing-the-right-signing-algorithm" # noqa
+ "Configure JWT_JWKS_URL to verify asymmetric tokens issued by the "
+ "platform auth service."
)
@@ -26,17 +28,72 @@ class Settings:
"JWT_VERIFY_KEY", os.getenv("SUPABASE_JWT_SECRET", "")
).strip()
self.JWT_ALGORITHM: str = os.getenv("JWT_SIGN_ALGORITHM", "HS256").strip()
+ self.JWT_JWKS_URL: str = os.getenv("JWT_JWKS_URL", "").strip()
+ self.JWT_JWKS_ALGORITHMS: list[str] = [
+ algo.strip()
+ for algo in os.getenv("JWT_JWKS_ALGORITHMS", "ES256,RS256,EdDSA").split(",")
+ if algo.strip()
+ ]
self.validate()
def validate(self):
- if not self.JWT_VERIFY_KEY:
+ if not self.JWT_JWKS_URL:
raise AuthConfigError(
- "JWT_VERIFY_KEY must be set. "
- "An empty JWT secret would allow anyone to forge valid tokens."
+ "JWT_JWKS_URL must be set to the JWKS endpoint of the platform "
+ "auth service (e.g. https://<frontend-host>/api/auth/jwks). "
+ "Better Auth issues asymmetric (ES256) tokens verified against "
+ "that endpoint, so without it the backend cannot verify any live "
+ "session. JWT_VERIFY_KEY is not a substitute: it only covers "
+ "transient legacy (Supabase HS256) tokens during the cutover "
+ "window."
)
- if len(self.JWT_VERIFY_KEY) < 32:
+ if self.JWT_JWKS_URL and not self.JWT_JWKS_URL.startswith(
+ ("http://", "https://")
+ ):
+ # Caught here rather than as a cryptic PyJWKClientError on the
+ # first request that hits the JWKS path.
+ raise AuthConfigError(
+ f"Invalid JWT_JWKS_URL: '{self.JWT_JWKS_URL}'. "
+ "Must be an http:// or https:// URL."
+ )
+
+ if self.JWT_JWKS_URL.startswith("http://"):
+ try:
+ hostname = urlparse(self.JWT_JWKS_URL).hostname or ""
+ except ValueError as e:
+ # Malformed netloc, e.g. an unbalanced IPv6 bracket.
+ raise AuthConfigError(
+ f"Invalid JWT_JWKS_URL: '{self.JWT_JWKS_URL}': {e}"
+ ) from e
+ # A single-label host is a container/service name on a private
+ # network (e.g. http://frontend:3000), as trusted as loopback.
+ host_is_local = hostname in ("localhost", "127.0.0.1", "::1") or (
+ "." not in hostname and ":" not in hostname
+ )
+ allow_insecure = os.getenv(
+ "JWKS_ALLOW_INSECURE_TRANSPORT", ""
+ ).strip().lower() in ("1", "true", "yes")
+ if not host_is_local and not allow_insecure:
+ raise AuthConfigError(
+ "JWT_JWKS_URL fetches keys over cleartext http:// from "
+ f"a non-local host ('{hostname}'). The backend trusts "
+ "whatever keys that URL returns, so an attacker in the "
+ "path could substitute them and forge tokens for any "
+ "user. Use https://, or set "
+ "JWKS_ALLOW_INSECURE_TRANSPORT=true if the network path "
+ "is trusted."
+ )
+ if not host_is_local:
+ logger.warning(
+ "⚠️ JWKS_ALLOW_INSECURE_TRANSPORT is enabled: JWKS keys "
+ f"are fetched over cleartext http:// from '{hostname}'. "
+ "Anyone in the network path can substitute them and forge "
+ "tokens. Use https:// unless the path is fully trusted."
+ )
+
+ if self.JWT_VERIFY_KEY and len(self.JWT_VERIFY_KEY) < 32:
logger.warning(
"⚠️ JWT_VERIFY_KEY appears weak (less than 32 characters). "
"Consider using a longer, cryptographically secure secret."
@@ -45,10 +102,9 @@ class Settings:
supported_algorithms = get_default_algorithms().keys()
if not has_crypto:
- logger.warning(
- "⚠️ Asymmetric JWT verification is not available "
- "because the 'cryptography' package is not installed. "
- + ALGO_RECOMMENDATION
+ raise AuthConfigError(
+ "'cryptography' package is required for JWT verification "
+ "but not installed"
)
if (
@@ -61,7 +117,30 @@ class Settings:
"https://pyjwt.readthedocs.io/en/stable/algorithms.html"
)
- if self.JWT_ALGORITHM.startswith("HS"):
+ for algo in self.JWT_JWKS_ALGORITHMS:
+ if (
+ algo not in supported_algorithms
+ or algo == "none"
+ or algo.startswith("HS")
+ ):
+ raise AuthConfigError(
+ f"Invalid JWT_JWKS_ALGORITHMS entry: '{algo}'. "
+ "JWKS verification only supports asymmetric algorithms."
+ )
+
+ if "ES256" not in self.JWT_JWKS_ALGORITHMS:
+ # Advisory, not fatal: a modified auth service could sign with
+ # something else, but the stock platform frontend signs ES256 —
+ # excluding it here silently rejects every token it issues.
+ logger.warning(
+ "⚠️ JWT_JWKS_ALGORITHMS does not include ES256, which is the "
+ "algorithm the platform auth service signs with. With this "
+ "setting, every token it issues will be rejected. Add ES256 "
+ "unless a customized auth service signs with a different "
+ "algorithm."
+ )
+
+ if self.JWT_VERIFY_KEY and self.JWT_ALGORITHM.startswith("HS"):
logger.warning(
f"⚠️ JWT_SIGN_ALGORITHM is set to '{self.JWT_ALGORITHM}', "
"a symmetric shared-key signature algorithm. " + ALGO_RECOMMENDATION
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config_test.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config_test.py
index 4d597c973d..14bd581287 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/config_test.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/config_test.py
@@ -11,11 +11,19 @@ from pytest_mock import MockerFixture
from autogpt_libs.auth.config import AuthConfigError, Settings
+# Better Auth verification requires a JWKS URL, so these tests set one to
+# exercise JWT_VERIFY_KEY / algorithm behavior without tripping the guard.
+VALID_JWKS_URL = "https://app.example/api/auth/jwks"
+
def test_environment_variable_precedence(mocker: MockerFixture):
"""Test that environment variables take precedence over defaults."""
secret = "environment-secret-key-with-proper-length-123456"
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == secret
@@ -24,7 +32,11 @@ def test_environment_variable_precedence(mocker: MockerFixture):
def test_environment_variable_backwards_compatible(mocker: MockerFixture):
"""Test that SUPABASE_JWT_SECRET is read if JWT_VERIFY_KEY is not set."""
secret = "environment-secret-key-with-proper-length-123456"
- mocker.patch.dict(os.environ, {"SUPABASE_JWT_SECRET": secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"SUPABASE_JWT_SECRET": secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == secret
@@ -40,7 +52,11 @@ def test_auth_config_error_inheritance():
def test_settings_static_after_creation(mocker: MockerFixture):
"""Test that settings maintain their values after creation."""
secret = "immutable-secret-key-with-proper-length-12345"
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
original_secret = settings.JWT_VERIFY_KEY
@@ -54,7 +70,11 @@ def test_settings_static_after_creation(mocker: MockerFixture):
def test_settings_load_with_valid_secret(mocker: MockerFixture):
"""Test auth enabled with a valid JWT secret."""
valid_secret = "a" * 32 # 32 character secret
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": valid_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": valid_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == valid_secret
@@ -63,37 +83,35 @@ def test_settings_load_with_valid_secret(mocker: MockerFixture):
def test_settings_load_with_strong_secret(mocker: MockerFixture):
"""Test auth enabled with a cryptographically strong secret."""
strong_secret = "super-secret-jwt-token-with-at-least-32-characters-long"
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": strong_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": strong_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == strong_secret
assert len(settings.JWT_VERIFY_KEY) >= 32
-def test_secret_empty_raises_error(mocker: MockerFixture):
- """Test that auth enabled with empty secret raises AuthConfigError."""
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": ""}, clear=True)
-
- with pytest.raises(Exception) as exc_info:
- Settings()
- assert "JWT_VERIFY_KEY" in str(exc_info.value)
-
-
-def test_secret_missing_raises_error(mocker: MockerFixture):
- """Test that auth enabled without secret env var raises AuthConfigError."""
- mocker.patch.dict(os.environ, {}, clear=True)
-
- with pytest.raises(Exception) as exc_info:
- Settings()
- assert "JWT_VERIFY_KEY" in str(exc_info.value)
-
-
[email protected]("secret", [" ", " ", "\t", "\n", " \t\n "])
-def test_secret_only_whitespace_raises_error(mocker: MockerFixture, secret: str):
- """Test that auth enabled with whitespace-only secret raises error."""
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret}, clear=True)
+ "verify_key_env",
+ [
+ pytest.param({}, id="no-verify-key"),
+ pytest.param({"JWT_VERIFY_KEY": ""}, id="empty-verify-key"),
+ pytest.param({"JWT_VERIFY_KEY": " \t\n "}, id="whitespace-verify-key"),
+ pytest.param({"JWT_VERIFY_KEY": "x" * 40}, id="strong-verify-key"),
+ ],
+)
+def test_missing_jwks_url_raises_regardless_of_verify_key(
+ mocker: MockerFixture, verify_key_env: dict[str, str]
+):
+ """JWT_JWKS_URL is the mandatory setting: without it Settings() must raise
+ about JWT_JWKS_URL specifically, and no state of the optional
+ JWT_VERIFY_KEY (absent, empty, whitespace, strong) substitutes for it."""
+ mocker.patch.dict(os.environ, verify_key_env, clear=True)
- with pytest.raises(ValueError):
+ with pytest.raises(AuthConfigError, match="JWT_JWKS_URL must be set"):
Settings()
@@ -102,7 +120,11 @@ def test_secret_weak_logs_warning(
):
"""Test that weak JWT secret triggers warning log."""
weak_secret = "short" # Less than 32 characters
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": weak_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": weak_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
with caplog.at_level(logging.WARNING):
settings = Settings()
@@ -116,7 +138,11 @@ def test_secret_31_char_logs_warning(
):
"""Test that 31-character secret triggers warning (boundary test)."""
secret_31 = "a" * 31 # Exactly 31 characters
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret_31}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": secret_31, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
with caplog.at_level(logging.WARNING):
settings = Settings()
@@ -129,7 +155,11 @@ def test_secret_32_char_no_warning(
):
"""Test that 32-character secret does not trigger warning (boundary test)."""
secret_32 = "a" * 32 # Exactly 32 characters
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret_32}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": secret_32, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
with caplog.at_level(logging.WARNING):
settings = Settings()
@@ -140,7 +170,11 @@ def test_secret_32_char_no_warning(
def test_secret_whitespace_stripped(mocker: MockerFixture):
"""Test that JWT secret whitespace is stripped."""
secret = "a" * 32
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": f" {secret} "}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": f" {secret} ", "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == secret
@@ -149,7 +183,11 @@ def test_secret_whitespace_stripped(mocker: MockerFixture):
def test_secret_with_special_characters(mocker: MockerFixture):
"""Test JWT secret with special characters."""
special_secret = "!@#$%^&*()_+-=[]{}|;:,.<>?`~" + "a" * 10 # 40 chars total
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": special_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": special_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == special_secret
@@ -158,7 +196,11 @@ def test_secret_with_special_characters(mocker: MockerFixture):
def test_secret_with_unicode(mocker: MockerFixture):
"""Test JWT secret with unicode characters."""
unicode_secret = "秘密🔐キー" + "a" * 25 # Ensure >32 bytes
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": unicode_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": unicode_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == unicode_secret
@@ -167,7 +209,11 @@ def test_secret_with_unicode(mocker: MockerFixture):
def test_secret_very_long(mocker: MockerFixture):
"""Test JWT secret with excessive length."""
long_secret = "a" * 1000 # 1000 character secret
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": long_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": long_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == long_secret
@@ -177,7 +223,11 @@ def test_secret_very_long(mocker: MockerFixture):
def test_secret_with_newline(mocker: MockerFixture):
"""Test JWT secret containing newlines."""
multiline_secret = "secret\nwith\nnewlines" + "a" * 20
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": multiline_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": multiline_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == multiline_secret
@@ -186,7 +236,11 @@ def test_secret_with_newline(mocker: MockerFixture):
def test_secret_base64_encoded(mocker: MockerFixture):
"""Test JWT secret that looks like base64."""
base64_secret = "dGhpc19pc19hX3NlY3JldF9rZXlfd2l0aF9wcm9wZXJfbGVuZ3Ro"
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": base64_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": base64_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == base64_secret
@@ -195,7 +249,11 @@ def test_secret_base64_encoded(mocker: MockerFixture):
def test_secret_numeric_only(mocker: MockerFixture):
"""Test JWT secret with only numbers."""
numeric_secret = "1234567890" * 4 # 40 character numeric secret
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": numeric_secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": numeric_secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_VERIFY_KEY == numeric_secret
@@ -203,7 +261,11 @@ def test_secret_numeric_only(mocker: MockerFixture):
def test_algorithm_default_hs256(mocker: MockerFixture):
"""Test that JWT algorithm defaults to HS256."""
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": "a" * 32}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": "a" * 32, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
settings = Settings()
assert settings.JWT_ALGORITHM == "HS256"
@@ -214,7 +276,11 @@ def test_algorithm_whitespace_stripped(mocker: MockerFixture):
secret = "a" * 32
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": secret, "JWT_SIGN_ALGORITHM": " HS256 "},
+ {
+ "JWT_VERIFY_KEY": secret,
+ "JWT_SIGN_ALGORITHM": " HS256 ",
+ "JWT_JWKS_URL": VALID_JWKS_URL,
+ },
clear=True,
)
@@ -223,17 +289,22 @@ def test_algorithm_whitespace_stripped(mocker: MockerFixture):
def test_no_crypto_warning(mocker: MockerFixture, caplog: pytest.LogCaptureFixture):
- """Test warning when crypto package is not available."""
+ """Test that a missing crypto package raises a clear error when
+ JWT_JWKS_URL is set, since JWT_JWKS_URL is now mandatory and asymmetric
+ verification can't silently fall back to a warning anymore."""
secret = "a" * 32
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": secret}, clear=True)
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": secret, "JWT_JWKS_URL": VALID_JWKS_URL},
+ clear=True,
+ )
# Mock has_crypto to return False
mocker.patch("autogpt_libs.auth.config.has_crypto", False)
- with caplog.at_level(logging.WARNING):
+ with pytest.raises(AuthConfigError) as exc_info:
Settings()
- assert "Asymmetric JWT verification is not available" in caplog.text
- assert "cryptography" in caplog.text
+ assert "cryptography" in str(exc_info.value)
def test_algorithm_invalid_raises_error(mocker: MockerFixture):
@@ -241,7 +312,11 @@ def test_algorithm_invalid_raises_error(mocker: MockerFixture):
secret = "a" * 32
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": secret, "JWT_SIGN_ALGORITHM": "INVALID_ALG"},
+ {
+ "JWT_VERIFY_KEY": secret,
+ "JWT_SIGN_ALGORITHM": "INVALID_ALG",
+ "JWT_JWKS_URL": VALID_JWKS_URL,
+ },
clear=True,
)
@@ -256,7 +331,11 @@ def test_algorithm_none_raises_error(mocker: MockerFixture):
secret = "a" * 32
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": secret, "JWT_SIGN_ALGORITHM": "none"},
+ {
+ "JWT_VERIFY_KEY": secret,
+ "JWT_SIGN_ALGORITHM": "none",
+ "JWT_JWKS_URL": VALID_JWKS_URL,
+ },
clear=True,
)
@@ -273,7 +352,11 @@ def test_algorithm_symmetric_warning(
secret = "a" * 32
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": secret, "JWT_SIGN_ALGORITHM": algorithm},
+ {
+ "JWT_VERIFY_KEY": secret,
+ "JWT_SIGN_ALGORITHM": algorithm,
+ "JWT_JWKS_URL": VALID_JWKS_URL,
+ },
clear=True,
)
@@ -295,7 +378,11 @@ def test_algorithm_asymmetric_no_warning(
secret = "a" * 32
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": secret, "JWT_SIGN_ALGORITHM": algorithm},
+ {
+ "JWT_VERIFY_KEY": secret,
+ "JWT_SIGN_ALGORITHM": algorithm,
+ "JWT_JWKS_URL": VALID_JWKS_URL,
+ },
clear=True,
)
@@ -304,3 +391,194 @@ def test_algorithm_asymmetric_no_warning(
# Should not contain the symmetric algorithm warning
assert "symmetric shared-key signature algorithm" not in caplog.text
assert settings.JWT_ALGORITHM == algorithm
+
+
+def test_jwks_url_alone_is_sufficient(mocker: MockerFixture):
+ """Test that JWT_JWKS_URL without a shared secret passes validation."""
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks"},
+ clear=True,
+ )
+
+ settings = Settings()
+ assert settings.JWT_JWKS_URL == "http://localhost:3000/api/auth/jwks"
+ assert settings.JWT_VERIFY_KEY == ""
+
+
+def test_jwks_algorithms_default(mocker: MockerFixture):
+ """Test the default JWKS algorithm allow-list."""
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks"},
+ clear=True,
+ )
+
+ settings = Settings()
+ assert settings.JWT_JWKS_ALGORITHMS == ["ES256", "RS256", "EdDSA"]
+
+
+def test_jwks_algorithms_custom(mocker: MockerFixture):
+ """Test overriding the JWKS algorithm allow-list."""
+ mocker.patch.dict(
+ os.environ,
+ {
+ "JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks",
+ "JWT_JWKS_ALGORITHMS": "ES256",
+ },
+ clear=True,
+ )
+
+ settings = Settings()
+ assert settings.JWT_JWKS_ALGORITHMS == ["ES256"]
+
+
[email protected]("algorithm", ["HS256", "none", "INVALID"])
+def test_jwks_algorithms_rejects_unsafe_entries(mocker: MockerFixture, algorithm: str):
+ """Test that symmetric/invalid algorithms are rejected for JWKS use."""
+ mocker.patch.dict(
+ os.environ,
+ {
+ "JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks",
+ "JWT_JWKS_ALGORITHMS": algorithm,
+ },
+ clear=True,
+ )
+
+ with pytest.raises(AuthConfigError) as exc_info:
+ Settings()
+ assert "JWT_JWKS_ALGORITHMS" in str(exc_info.value)
+
+
+def test_neither_key_nor_jwks_raises_error(mocker: MockerFixture):
+ """Test that missing both verification mechanisms raises AuthConfigError."""
+ mocker.patch.dict(os.environ, {}, clear=True)
+
+ with pytest.raises(AuthConfigError) as exc_info:
+ Settings()
+ assert "JWT_JWKS_URL" in str(exc_info.value)
+ assert "JWT_VERIFY_KEY" in str(exc_info.value)
+
+
+ "bad_url",
+ ["localhost:3000/jwks", "ftp://host/jwks", "/api/auth/jwks", "not a url"],
+)
+def test_jwks_url_must_be_http(mocker: MockerFixture, bad_url: str):
+ """A non-http(s) JWT_JWKS_URL is rejected at config time, not as a
+ cryptic PyJWKClientError on the first token."""
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": bad_url}, clear=True)
+
+ with pytest.raises(AuthConfigError) as exc_info:
+ Settings()
+ assert "JWT_JWKS_URL" in str(exc_info.value)
+
+
+ "good_url",
+ ["http://localhost:3000/api/auth/jwks", "https://app.example/api/auth/jwks"],
+)
+def test_jwks_url_accepts_http_and_https(mocker: MockerFixture, good_url: str):
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": good_url}, clear=True)
+
+ settings = Settings()
+ assert settings.JWT_JWKS_URL == good_url
+
+
+def test_jwks_url_cleartext_remote_host_is_rejected(mocker: MockerFixture):
+ """A cleartext JWKS URL pointing at a routable host must not boot: an
+ attacker in the network path could substitute the keys and forge tokens."""
+ insecure_url = "http://auth.example.com/api/auth/jwks"
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": insecure_url}, clear=True)
+
+ with pytest.raises(AuthConfigError, match="JWKS_ALLOW_INSECURE_TRANSPORT"):
+ Settings()
+
+
+ "url",
+ [
+ "http://localhost:3000/api/auth/jwks",
+ "http://127.0.0.1:3000/api/auth/jwks",
+ "http://[::1]:3000/api/auth/jwks",
+ # Docker service name: single-label host on a private network.
+ "http://frontend:3000/api/auth/jwks",
+ "https://auth.example.com/api/auth/jwks",
+ ],
+)
+def test_jwks_url_trusted_transport_does_not_warn(
+ mocker: MockerFixture, caplog: pytest.LogCaptureFixture, url: str
+):
+ """Loopback, container-internal and https URLs stay quiet."""
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": url}, clear=True)
+
+ with caplog.at_level(logging.WARNING):
+ Settings()
+ assert "cleartext" not in caplog.text
+
+
+ "malformed_url",
+ ["http://[::1/api/auth/jwks", "http://]::1[/api/auth/jwks"],
+)
+def test_jwks_url_malformed_host_fails_at_boot(
+ mocker: MockerFixture, malformed_url: str
+):
+ """A URL urlparse() can't parse (e.g. unbalanced IPv6 bracket) is unviable
+ config and must fail at boot with a clear error, not at first fetch."""
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": malformed_url}, clear=True)
+
+ with pytest.raises(AuthConfigError, match="Invalid JWT_JWKS_URL"):
+ Settings()
+
+
[email protected]("override", ["1", "true", "TRUE", "yes"])
+def test_jwks_url_cleartext_allowed_with_override_but_warns(
+ mocker: MockerFixture, caplog: pytest.LogCaptureFixture, override: str
+):
+ """JWKS_ALLOW_INSECURE_TRANSPORT lets a trusted-path deployment boot,
+ with a warning on record that the transport is cleartext."""
+ mocker.patch.dict(
+ os.environ,
+ {
+ "JWT_JWKS_URL": "http://auth.example.com/api/auth/jwks",
+ "JWKS_ALLOW_INSECURE_TRANSPORT": override,
+ },
+ clear=True,
+ )
+
+ with caplog.at_level(logging.WARNING):
+ Settings()
+ assert "cleartext" in caplog.text
+
+
+def test_warns_when_es256_missing_from_jwks_algorithms(
+ mocker: MockerFixture, caplog: pytest.LogCaptureFixture
+):
+ """The platform frontend signs ES256; excluding it rejects every token."""
+ mocker.patch.dict(
+ os.environ,
+ {
+ "JWT_JWKS_URL": "https://app.example/api/auth/jwks",
+ "JWT_JWKS_ALGORITHMS": "ES384,ES512",
+ },
+ clear=True,
+ )
+
+ with caplog.at_level(logging.WARNING):
+ Settings()
+ assert "does not include ES256" in caplog.text
+
+
+def test_no_warning_when_es256_present(
+ mocker: MockerFixture, caplog: pytest.LogCaptureFixture
+):
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_JWKS_URL": "https://app.example/api/auth/jwks"},
+ clear=True,
+ )
+
+ with caplog.at_level(logging.WARNING):
+ Settings()
+ assert "does not include ES256" not in caplog.text
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/dependencies_test.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/dependencies_test.py
index 95795c2cfc..01ec1cf704 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/dependencies_test.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/dependencies_test.py
@@ -11,6 +11,8 @@ from fastapi import FastAPI, HTTPException, Request, Security
from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
+from autogpt_libs.auth import config
+from autogpt_libs.auth.config import Settings
from autogpt_libs.auth.dependencies import (
get_user_id,
requires_admin_user,
@@ -123,11 +125,13 @@ class TestAuthDependencies:
@pytest.mark.asyncio
async def test_requires_admin_user_missing_role(self):
- """Test requires_admin_user with missing role."""
+ """A missing 'role' claim must fail closed (403), not raise KeyError."""
jwt_payload = {"sub": "user-123", "email": "[email protected]"}
- with pytest.raises(KeyError):
+ with pytest.raises(HTTPException) as exc_info:
await requires_admin_user(jwt_payload)
+ assert exc_info.value.status_code == 403
+ assert "Admin access required" in exc_info.value.detail
@pytest.mark.asyncio
async def test_get_user_id_with_valid_payload(self, mocker: MockerFixture):
@@ -176,11 +180,19 @@ class TestAuthDependenciesIntegration:
"""Helper to create JWT tokens."""
import jwt
+ # JWT_JWKS_URL is required by Settings.validate(); HS256 tokens verify
+ # against JWT_VERIFY_KEY and never touch the JWKS client, so a
+ # present-but-unused URL is enough. Reset the cached settings so
+ # get_settings() rebuilds under this patched environment.
mocker.patch.dict(
os.environ,
- {"JWT_VERIFY_KEY": self.acceptable_jwt_secret},
+ {
+ "JWT_VERIFY_KEY": self.acceptable_jwt_secret,
+ "JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks",
+ },
clear=True,
)
+ mocker.patch.object(config, "_settings", Settings())
def _create_token(payload, secret=self.acceptable_jwt_secret):
return jwt.encode(payload, secret, algorithm="HS256")
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/helpers_test.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/helpers_test.py
index 7fc95e8306..824ce1e58f 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/helpers_test.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/helpers_test.py
@@ -3,10 +3,7 @@ Comprehensive tests for auth helpers module to achieve 100% coverage.
Tests OpenAPI schema generation and authentication response handling.
"""
-from unittest import mock
-
from fastapi import FastAPI
-from fastapi.openapi.utils import get_openapi
from autogpt_libs.auth.helpers import add_auth_responses_to_openapi
from autogpt_libs.auth.jwt_utils import bearer_jwt_auth
@@ -224,29 +221,26 @@ def test_add_auth_responses_to_openapi_multiple_security_schemes():
def test_add_auth_responses_to_openapi_empty_components():
- """Test when OpenAPI schema has no components section initially."""
+ """Components section is created when the base schema lacks one."""
app = FastAPI()
- # Mock get_openapi to return schema without components
- original_get_openapi = get_openapi
+ # add_auth_responses_to_openapi wraps app.openapi; feed it a base schema
+ # with no "components" to exercise the create-components branch.
+ base_openapi = app.openapi
- def mock_get_openapi(*args, **kwargs):
- schema = original_get_openapi(*args, **kwargs)
- # Remove components if it exists
- if "components" in schema:
- del schema["components"]
+ def openapi_without_components():
+ schema = base_openapi()
+ schema.pop("components", None)
return schema
- with mock.patch("autogpt_libs.auth.helpers.get_openapi", mock_get_openapi):
- # Apply customization
- add_auth_responses_to_openapi(app)
+ app.openapi = openapi_without_components
+ add_auth_responses_to_openapi(app)
- schema = app.openapi()
+ schema = app.openapi()
- # Components should be created
- assert "components" in schema
- assert "responses" in schema["components"]
- assert "HTTP401NotAuthenticatedError" in schema["components"]["responses"]
+ assert "components" in schema
+ assert "responses" in schema["components"]
+ assert "HTTP401NotAuthenticatedError" in schema["components"]["responses"]
def test_add_auth_responses_to_openapi_all_http_methods():
@@ -333,7 +327,6 @@ def test_endpoint_without_responses_section():
app = FastAPI()
from fastapi import Security
- from fastapi.openapi.utils import get_openapi as original_get_openapi
from autogpt_libs.auth.jwt_utils import get_jwt_payload
@@ -342,67 +335,54 @@ def test_endpoint_without_responses_section():
def endpoint_without_responses(jwt: dict = Security(get_jwt_payload)):
return {"data": "test"}
- # Mock get_openapi to remove responses from the endpoint
- def mock_get_openapi(*args, **kwargs):
- schema = original_get_openapi(*args, **kwargs)
- # Remove responses from our endpoint to trigger line 40
- if "/no-responses" in schema.get("paths", {}):
- if "get" in schema["paths"]["/no-responses"]:
- # Delete responses to force the code to create it
- if "responses" in schema["paths"]["/no-responses"]["get"]:
- del schema["paths"]["/no-responses"]["get"]["responses"]
+ # Feed a base schema whose secured endpoint has no "responses" section to
+ # exercise the create-responses branch.
+ base_openapi = app.openapi
+
+ def openapi_without_endpoint_responses():
+ schema = base_openapi()
+ get_op = schema.get("paths", {}).get("/no-responses", {}).get("get")
+ if get_op is not None:
+ get_op.pop("responses", None)
return schema
- with mock.patch("autogpt_libs.auth.helpers.get_openapi", mock_get_openapi):
- # Apply customization
- add_auth_responses_to_openapi(app)
+ app.openapi = openapi_without_endpoint_responses
+ add_auth_responses_to_openapi(app)
- # Get schema and verify 401 was added
- schema = app.openapi()
+ schema = app.openapi()
- # The endpoint should now have 401 response
- if "/no-responses" in schema["paths"]:
- if "get" in schema["paths"]["/no-responses"]:
- responses = schema["paths"]["/no-responses"]["get"].get("responses", {})
- assert "401" in responses
- assert (
- responses["401"]["$ref"]
- == "#/components/responses/HTTP401NotAuthenticatedError"
- )
+ responses = schema["paths"]["/no-responses"]["get"].get("responses", {})
+ assert "401" in responses
+ assert (
+ responses["401"]["$ref"]
+ == "#/components/responses/HTTP401NotAuthenticatedError"
+ )
def test_components_with_existing_responses():
- """Test when components already has a responses section."""
+ """An existing components.responses entry is preserved alongside the 401."""
app = FastAPI()
- # Mock get_openapi to return schema with existing components/responses
- from fastapi.openapi.utils import get_openapi as original_get_openapi
+ base_openapi = app.openapi
- def mock_get_openapi(*args, **kwargs):
- schema = original_get_openapi(*args, **kwargs)
- # Add existing components/responses
- if "components" not in schema:
- schema["components"] = {}
+ def openapi_with_existing_response():
+ schema = base_openapi()
+ schema.setdefault("components", {})
schema["components"]["responses"] = {
"ExistingResponse": {"description": "An existing response"}
}
return schema
- with mock.patch("autogpt_libs.auth.helpers.get_openapi", mock_get_openapi):
- # Apply customization
- add_auth_responses_to_openapi(app)
+ app.openapi = openapi_with_existing_response
+ add_auth_responses_to_openapi(app)
- schema = app.openapi()
+ schema = app.openapi()
- # Both responses should exist
- assert "ExistingResponse" in schema["components"]["responses"]
- assert "HTTP401NotAuthenticatedError" in schema["components"]["responses"]
+ assert "ExistingResponse" in schema["components"]["responses"]
+ assert "HTTP401NotAuthenticatedError" in schema["components"]["responses"]
- # Verify our 401 response structure
- error_response = schema["components"]["responses"][
- "HTTP401NotAuthenticatedError"
- ]
- assert error_response["description"] == "Authentication required"
+ error_response = schema["components"]["responses"]["HTTP401NotAuthenticatedError"]
+ assert error_response["description"] == "Authentication required"
def test_openapi_schema_persistence():
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py
index 1341b21781..e0b8a9ec0c 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py
@@ -1,4 +1,6 @@
+import asyncio
import logging
+import threading
from typing import Any
import jwt
@@ -15,6 +17,23 @@ bearer_jwt_auth = HTTPBearer(
bearerFormat="jwt", scheme_name="HTTPBearerJWT", auto_error=False
)
+# Refresh the cached JWK set hourly; key rotation keeps old keys in the set
+# during the grace period, so a stale cache only matters for brand-new keys
+# (handled below by PyJWKClient's kid-miss refetch).
+JWKS_CACHE_LIFESPAN_SECONDS = 3600
+
+# Upper bound on a single JWKS fetch. The JWKS endpoint is our own frontend, so
+# a slow response means it is redeploying or unhealthy — fail the request
+# quickly rather than tying up a worker for PyJWT's 30s default.
+JWKS_FETCH_TIMEOUT_SECONDS = 5
+
+# Cached client keyed on the JWKS URL: if the URL changes (config reload,
+# test override), the old client is discarded instead of silently serving
+# keys from the previous endpoint.
+_jwks_client: jwt.PyJWKClient | None = None
+_jwks_client_url: str | None = None
+_jwks_client_lock = threading.Lock()
+
async def get_jwt_payload(
credentials: HTTPAuthorizationCredentials | None = Security(bearer_jwt_auth),
@@ -35,34 +54,112 @@ async def get_jwt_payload(
raise HTTPException(status_code=401, detail="Authorization header is missing")
try:
- payload = parse_jwt_token(credentials.credentials)
+ payload = await parse_jwt_token_async(credentials.credentials)
logger.debug("Token decoded successfully")
return payload
except ValueError as e:
- raise HTTPException(status_code=401, detail=str(e))
+ raise HTTPException(status_code=401, detail=str(e)) from e
+
+
+async def parse_jwt_token_async(
+ token: str, audience: str = "authenticated"
+) -> dict[str, Any]:
+ """Async wrapper around :func:`parse_jwt_token`.
+
+ On a JWKS cache miss the verification does a *synchronous* HTTP fetch
+ (PyJWKClient uses urllib). Awaiting that directly on the event loop stalls
+ every other request on the worker until it returns, not just this one — so
+ hand it to a thread. Cache hits are pure CPU and return immediately.
+ """
+ return await asyncio.to_thread(parse_jwt_token, token, audience)
-def parse_jwt_token(token: str) -> dict[str, Any]:
+def parse_jwt_token(token: str, audience: str = "authenticated") -> dict[str, Any]:
"""
Parse and validate a JWT token.
+ Symmetric (HS*) tokens are verified with the shared secret
+ (`JWT_VERIFY_KEY`); asymmetric tokens are verified against the JWK set
+ published by the platform auth service (`JWT_JWKS_URL`). Both paths can be
+ active at once, which keeps sessions issued by a previous auth provider
+ valid during a migration window.
+
:param token: The token to parse
+ :param audience: The `aud` claim the token must carry. Defaults to the
+ user-token audience; service tokens use a distinct audience so the
+ two planes can't be replayed against each other.
:return: The decoded payload
:raises ValueError: If the token is invalid or expired
"""
settings = get_settings()
+ try:
+ header = jwt.get_unverified_header(token)
+ except jwt.InvalidTokenError as e:
+ raise ValueError(f"Invalid token: {str(e)}") from e
+
+ algorithm = header.get("alg", "")
+ if algorithm.startswith("HS"):
+ if not settings.JWT_VERIFY_KEY:
+ raise ValueError("Invalid token: symmetric tokens are not accepted")
+ key = settings.JWT_VERIFY_KEY
+ algorithms = [settings.JWT_ALGORITHM]
+ else:
+ if not settings.JWT_JWKS_URL:
+ raise ValueError("Invalid token: asymmetric tokens are not accepted")
+ try:
+ key = _get_jwks_client().get_signing_key_from_jwt(token).key
+ algorithms = settings.JWT_JWKS_ALGORITHMS
+ except jwt.PyJWKClientError as e:
+ # The legacy verifier supported — and its config text recommended —
+ # asymmetric algorithms, with the public key in JWT_VERIFY_KEY. A
+ # token whose kid isn't in the Better Auth JWK set can therefore
+ # still be a live legacy session from that configuration, so the
+ # migration-window grace extends here too: fall back to the shared
+ # legacy key when it's configured for a matching asymmetric alg.
+ if (
+ settings.JWT_VERIFY_KEY
+ and not settings.JWT_ALGORITHM.startswith("HS")
+ and algorithm == settings.JWT_ALGORITHM
+ ):
+ key = settings.JWT_VERIFY_KEY
+ algorithms = [settings.JWT_ALGORITHM]
+ else:
+ raise ValueError(f"Invalid token: {str(e)}") from e
+
try:
payload = jwt.decode(
token,
- settings.JWT_VERIFY_KEY,
- algorithms=[settings.JWT_ALGORITHM],
- audience="authenticated",
+ key,
+ algorithms=algorithms,
+ audience=audience,
)
return payload
- except jwt.ExpiredSignatureError:
- raise ValueError("Token has expired")
+ except jwt.ExpiredSignatureError as e:
+ raise ValueError("Token has expired") from e
except jwt.InvalidTokenError as e:
- raise ValueError(f"Invalid token: {str(e)}")
+ raise ValueError(f"Invalid token: {str(e)}") from e
+
+
+def _get_jwks_client() -> jwt.PyJWKClient:
+ global _jwks_client, _jwks_client_url
+
+ url = get_settings().JWT_JWKS_URL
+ if _jwks_client is not None and _jwks_client_url == url:
+ return _jwks_client
+
+ with _jwks_client_lock:
+ if _jwks_client is None or _jwks_client_url != url:
+ _jwks_client = jwt.PyJWKClient(
+ url,
+ cache_keys=True,
+ lifespan=JWKS_CACHE_LIFESPAN_SECONDS,
+ # PyJWT defaults to 30s. The fetch is synchronous, so on a
+ # cache miss that is 30s of a worker doing nothing — bound it
+ # to something closer to "the frontend is briefly redeploying".
+ timeout=JWKS_FETCH_TIMEOUT_SECONDS,
+ )
+ _jwks_client_url = url
+ return _jwks_client
def verify_user(jwt_payload: dict | None, admin_only: bool) -> User:
@@ -74,7 +171,7 @@ def verify_user(jwt_payload: dict | None, admin_only: bool) -> User:
if not user_id:
raise HTTPException(status_code=401, detail="User ID not found in token")
- if admin_only and jwt_payload["role"] != "admin":
+ if admin_only and jwt_payload.get("role") != "admin":
raise HTTPException(status_code=403, detail="Admin access required")
return User.from_payload(jwt_payload)
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils_test.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils_test.py
index c76dee66b5..fa22b04993 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils_test.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils_test.py
@@ -8,8 +8,10 @@ from datetime import datetime, timedelta, timezone
import jwt
import pytest
+from cryptography.hazmat.primitives.asymmetric import ec
from fastapi import HTTPException
from fastapi.security import HTTPAuthorizationCredentials
+from jwt.algorithms import ECAlgorithm
from pytest_mock import MockerFixture
from autogpt_libs.auth import config, jwt_utils
@@ -17,6 +19,7 @@ from autogpt_libs.auth.config import Settings
from autogpt_libs.auth.models import User
MOCK_JWT_SECRET = "test-secret-key-with-at-least-32-characters"
+MOCK_JWKS_URL = "http://localhost:3000/api/auth/jwks"
TEST_USER_PAYLOAD = {
"sub": "test-user-id",
"role": "user",
@@ -33,8 +36,17 @@ TEST_ADMIN_PAYLOAD = {
@pytest.fixture(autouse=True)
def mock_config(mocker: MockerFixture):
- mocker.patch.dict(os.environ, {"JWT_VERIFY_KEY": MOCK_JWT_SECRET}, clear=True)
+ # JWT_JWKS_URL is required by Settings.validate(); the HS256 tests never
+ # touch the JWKS client (they verify against JWT_VERIFY_KEY), so a URL that
+ # is present-but-unused is enough to satisfy config validation.
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": MOCK_JWT_SECRET, "JWT_JWKS_URL": MOCK_JWKS_URL},
+ clear=True,
+ )
mocker.patch.object(config, "_settings", Settings())
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
yield
@@ -207,11 +219,13 @@ def test_verify_user_none_sub():
def test_verify_user_missing_role_admin_check():
- """Test verifying admin when role field is missing."""
+ """A missing 'role' claim under admin_only must fail closed (403), not
+ KeyError -> 500."""
no_role_payload = {"sub": "user-id"}
- with pytest.raises(KeyError):
- # This will raise KeyError when checking payload["role"]
+ with pytest.raises(HTTPException) as exc_info:
jwt_utils.verify_user(no_role_payload, admin_only=True)
+ assert exc_info.value.status_code == 403
+ assert "Admin access required" in exc_info.value.detail
# ======================== EDGE CASES ======================== #
@@ -306,3 +320,199 @@ def test_jwt_with_different_algorithms():
with pytest.raises(ValueError) as exc_info:
jwt_utils.parse_jwt_token(token)
assert "Invalid token" in str(exc_info.value)
+
+
+# ==================== JWKS (ASYMMETRIC) VERIFICATION ==================== #
+
+
+def make_es256_keypair(kid: str = "test-key-1"):
+ """Generate an EC P-256 keypair and the matching JWK set document."""
+ private_key = ec.generate_private_key(ec.SECP256R1())
+ jwk = ECAlgorithm.to_jwk(private_key.public_key(), as_dict=True)
+ jwk.update({"kid": kid, "alg": "ES256", "use": "sig"})
+ return private_key, {"keys": [jwk]}
+
+
+def create_es256_token(payload, private_key, kid: str = "test-key-1") -> str:
+ return jwt.encode(payload, private_key, algorithm="ES256", headers={"kid": kid})
+
+
+def jwks_config(mocker: MockerFixture):
+ """Configure both the legacy shared secret and a JWKS endpoint."""
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": MOCK_JWT_SECRET, "JWT_JWKS_URL": MOCK_JWKS_URL},
+ clear=True,
+ )
+ mocker.patch.object(config, "_settings", Settings())
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
+
+ private_key, jwk_set = make_es256_keypair()
+ mocker.patch.object(jwt.PyJWKClient, "fetch_data", return_value=jwk_set)
+ yield private_key
+
+
+def test_parse_jwt_token_es256_via_jwks(jwks_config):
+ """An asymmetric token signed by the JWKS key is accepted."""
+ token = create_es256_token(TEST_USER_PAYLOAD, jwks_config)
+ result = jwt_utils.parse_jwt_token(token)
+
+ assert result["sub"] == "test-user-id"
+ assert result["role"] == "user"
+
+
+def test_parse_jwt_token_hs256_still_works_alongside_jwks(jwks_config):
+ """Legacy shared-secret tokens remain valid while JWKS is configured."""
+ token = create_token(TEST_USER_PAYLOAD)
+ result = jwt_utils.parse_jwt_token(token)
+
+ assert result["sub"] == "test-user-id"
+
+
+def test_parse_jwt_token_es256_expired(jwks_config):
+ """An expired asymmetric token is rejected as expired."""
+ expired_payload = {
+ **TEST_USER_PAYLOAD,
+ "exp": datetime.now(timezone.utc) - timedelta(hours=1),
+ }
+ token = create_es256_token(expired_payload, jwks_config)
+
+ with pytest.raises(ValueError, match="Token has expired"):
+ jwt_utils.parse_jwt_token(token)
+
+
+def test_parse_jwt_token_es256_wrong_audience(jwks_config):
+ """An asymmetric token without the expected audience is rejected."""
+ wrong_aud_payload = {**TEST_USER_PAYLOAD, "aud": "wrong-audience"}
+ token = create_es256_token(wrong_aud_payload, jwks_config)
+
+ with pytest.raises(ValueError, match="Invalid token"):
+ jwt_utils.parse_jwt_token(token)
+
+
+def test_parse_jwt_token_es256_wrong_key(jwks_config):
+ """A token signed by a key that is not in the JWK set is rejected."""
+ other_private_key, _ = make_es256_keypair(kid="other-key")
+ token = create_es256_token(TEST_USER_PAYLOAD, other_private_key, kid="other-key")
+
+ with pytest.raises(ValueError, match="Invalid token"):
+ jwt_utils.parse_jwt_token(token)
+
+
+# Note: "asymmetric rejected without JWKS_URL" is not testable via a valid
+# Settings() — JWT_JWKS_URL is now mandatory (config.validate raises without
+# it), so that guard in parse_jwt_token is unreachable dead code. The positive
+# path is covered by test_parse_jwt_token_es256_via_jwks.
+
+
+def test_parse_jwt_token_symmetric_rejected_without_shared_secret(
+ mocker: MockerFixture,
+):
+ """Symmetric tokens are rejected when only JWKS verification is configured."""
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": MOCK_JWKS_URL}, clear=True)
+ mocker.patch.object(config, "_settings", Settings())
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
+
+ token = create_token(TEST_USER_PAYLOAD)
+
+ with pytest.raises(ValueError, match="symmetric tokens are not accepted"):
+ jwt_utils.parse_jwt_token(token)
+
+
+def test_jwks_client_rekeys_when_url_changes(mocker: MockerFixture):
+ """A changed JWT_JWKS_URL must produce a new client, not reuse the old
+ one pointed at the previous endpoint."""
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
+
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": "http://first/jwks"}, clear=True)
+ mocker.patch.object(config, "_settings", Settings())
+ first = jwt_utils._get_jwks_client()
+ assert jwt_utils._get_jwks_client() is first # same URL -> cached
+
+ mocker.patch.dict(os.environ, {"JWT_JWKS_URL": "http://second/jwks"}, clear=True)
+ mocker.patch.object(config, "_settings", Settings())
+ second = jwt_utils._get_jwks_client()
+
+ assert second is not first
+ assert second.uri == "http://second/jwks"
+
+
+def test_verify_user_missing_role_is_not_a_server_error():
+ """A token with no `role` claim must resolve as a plain user, not KeyError.
+
+ verify_user already fails closed for admin_only; this covers the ordinary
+ path, where indexing payload["role"] would surface as a 500 instead of a
+ normal authenticated request.
+ """
+ no_role_payload = {"sub": "user-id", "email": "[email protected]"}
+
+ user = jwt_utils.verify_user(no_role_payload, admin_only=False)
+
+ assert user.user_id == "user-id"
+ assert user.role == "user"
+
+
+def _public_pem(private_key) -> str:
+ from cryptography.hazmat.primitives import serialization
+
+ return (
+ private_key.public_key()
+ .public_bytes(
+ encoding=serialization.Encoding.PEM,
+ format=serialization.PublicFormat.SubjectPublicKeyInfo,
+ )
+ .decode()
+ )
+
+
+def test_parse_jwt_token_legacy_asymmetric_token_falls_back_to_verify_key(
+ mocker: MockerFixture,
+):
+ """Migration grace must cover the RECOMMENDED legacy config, not just HS256.
+
+ The legacy verifier was jwt.decode(token, JWT_VERIFY_KEY,
+ algorithms=[JWT_ALGORITHM]) and its config text recommended ES256 — so
+ JWT_VERIFY_KEY can hold an asymmetric public key. A legacy ES256 token's
+ kid is not in the Better Auth JWK set; on that miss the parser must fall
+ back to the legacy key instead of rejecting every live session from that
+ configuration.
+ """
+ legacy_private, _ = make_es256_keypair(kid="legacy-key")
+ mocker.patch.dict(
+ os.environ,
+ {
+ "JWT_VERIFY_KEY": _public_pem(legacy_private),
+ "JWT_SIGN_ALGORITHM": "ES256",
+ "JWT_JWKS_URL": MOCK_JWKS_URL,
+ },
+ clear=True,
+ )
+ mocker.patch.object(config, "_settings", Settings())
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
+
+ # The JWKS endpoint serves a DIFFERENT (Better Auth) key set, so the
+ # legacy token's kid misses.
+ _, better_auth_jwks = make_es256_keypair(kid="better-auth-key")
+ mocker.patch.object(jwt.PyJWKClient, "fetch_data", return_value=better_auth_jwks)
+
+ token = create_es256_token(TEST_USER_PAYLOAD, legacy_private, kid="legacy-key")
+ result = jwt_utils.parse_jwt_token(token)
+
+ assert result["sub"] == "test-user-id"
+
+
+def test_parse_jwt_token_unknown_kid_still_rejected_without_asymmetric_legacy_key(
+ jwks_config,
+):
+ """The fallback must not weaken the default config: with an HS-configured
+ JWT_ALGORITHM, an unknown-kid asymmetric token stays rejected."""
+ other_private_key, _ = make_es256_keypair(kid="unknown-key")
+ token = create_es256_token(TEST_USER_PAYLOAD, other_private_key, kid="unknown-key")
+
+ with pytest.raises(ValueError, match="Invalid token"):
+ jwt_utils.parse_jwt_token(token)
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/models.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/models.py
index dc4251fb44..e1911b2c15 100644
--- a/autogpt_platform/autogpt_libs/autogpt_libs/auth/models.py
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/models.py
@@ -18,7 +18,11 @@ class User:
user_id=payload["sub"],
email=payload.get("email", ""),
phone_number=payload.get("phone", ""),
- role=payload["role"],
+ # Default rather than index: a token without a `role` claim is a
+ # token we simply don't grant privileges to, so it should be
+ # treated as an ordinary user — not raise KeyError and surface as
+ # a 500. verify_user already fails closed on the admin check.
+ role=payload.get("role", "user"),
)
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/service.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/service.py
new file mode 100644
index 0000000000..d36d7d95b7
--- /dev/null
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/service.py
@@ -0,0 +1,89 @@
+"""
+Service-to-service authentication for trusted platform components.
+
+The Next.js frontend signs short-lived JWTs with its Better Auth JWKS key --
+the same key the backend already trusts for user tokens (`JWT_JWKS_URL`) --
+but with a distinct audience and subject, so user tokens and service tokens
+can never be replayed against each other's endpoints. This authenticates
+pre-login frontend->backend calls (e.g. auth emails), where no user session
+exists to vouch for the request, without introducing any new shared secret.
+"""
+
+import logging
+
+import fastapi
+import jwt
+from fastapi.security import HTTPAuthorizationCredentials
+
+from .config import get_settings
+from .jwt_utils import bearer_jwt_auth, parse_jwt_token_async
+
+logger = logging.getLogger(__name__)
+
+SERVICE_TOKEN_AUDIENCE = "autogpt-platform-backend"
+FRONTEND_SERVICE_SUBJECT = "service:frontend"
+
+
+def requires_frontend_service(scope: str):
+ """Factory returning a FastAPI dependency that authenticates the frontend
+ service itself (not a user) for the given scope.
+
+ Example::
+
+ @router.post(
+ "/send",
+ dependencies=[Security(requires_frontend_service("auth-email:send"))],
+ )
+ """
+
+ async def _dependency(
+ credentials: HTTPAuthorizationCredentials | None = fastapi.Security(
+ bearer_jwt_auth
+ ),
+ ) -> None:
+ if not get_settings().JWT_JWKS_URL:
+ raise fastapi.HTTPException(
+ status_code=503,
+ detail="Service authentication requires JWT_JWKS_URL to be set.",
+ )
+ if not credentials:
+ raise fastapi.HTTPException(
+ status_code=401, detail="Authorization header is missing"
+ )
+ token = credentials.credentials
+
+ try:
+ header = jwt.get_unverified_header(token)
+ except jwt.InvalidTokenError as e:
+ raise fastapi.HTTPException(
+ status_code=401, detail=f"Invalid token: {e}"
+ ) from e
+ # Service tokens are only ever JWKS-signed; the legacy HS256 shared
+ # secret must not be able to mint one.
+ if header.get("alg", "").startswith("HS"):
+ raise fastapi.HTTPException(
+ status_code=401,
+ detail=(
+ "Invalid token: symmetrically signed service tokens "
+ "are not accepted"
+ ),
+ )
+
+ try:
+ payload = await parse_jwt_token_async(
+ token, audience=SERVICE_TOKEN_AUDIENCE
+ )
+ except ValueError as e:
+ raise fastapi.HTTPException(status_code=401, detail=str(e)) from e
+
+ if payload.get("sub") != FRONTEND_SERVICE_SUBJECT:
+ raise fastapi.HTTPException(
+ status_code=401, detail="Not a frontend service token"
+ )
+ granted_scopes = str(payload.get("scope", "")).split()
+ if scope not in granted_scopes:
+ raise fastapi.HTTPException(
+ status_code=403, detail=f"Missing service scope: {scope}"
+ )
+
+ return _dependency
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/auth/service_test.py b/autogpt_platform/autogpt_libs/autogpt_libs/auth/service_test.py
new file mode 100644
index 0000000000..6b35b1ce22
--- /dev/null
+++ b/autogpt_platform/autogpt_libs/autogpt_libs/auth/service_test.py
@@ -0,0 +1,142 @@
+"""
+Tests for frontend service-token authentication (requires_frontend_service).
+
+Service tokens ride the same JWKS trust as user tokens but with a distinct
+audience and subject; these tests pin the separation between the two planes.
+"""
+
+import os
+from datetime import datetime, timedelta, timezone
+
+import jwt
+import pytest
+from cryptography.hazmat.primitives.asymmetric import ec
+from fastapi import FastAPI, Security
+from fastapi.testclient import TestClient
+from jwt.algorithms import ECAlgorithm
+from pytest_mock import MockerFixture
+
+from autogpt_libs.auth import config, jwt_utils
+from autogpt_libs.auth.config import Settings
+from autogpt_libs.auth.service import (
+ FRONTEND_SERVICE_SUBJECT,
+ SERVICE_TOKEN_AUDIENCE,
+ requires_frontend_service,
+)
+
+MOCK_JWT_SECRET = "test-secret-key-with-at-least-32-characters"
+MOCK_JWKS_URL = "http://localhost:3000/api/auth/jwks"
+
+SERVICE_PAYLOAD = {
+ "sub": FRONTEND_SERVICE_SUBJECT,
+ "aud": SERVICE_TOKEN_AUDIENCE,
+ "scope": "auth-email:send",
+}
+
+app = FastAPI()
+
+
+ "/guarded",
+ dependencies=[Security(requires_frontend_service("auth-email:send"))],
+)
+def guarded_endpoint():
+ return {"ok": True}
+
+
+client = TestClient(app)
+
+
+def make_es256_keypair(kid: str = "test-key-1"):
+ private_key = ec.generate_private_key(ec.SECP256R1())
+ jwk = ECAlgorithm.to_jwk(private_key.public_key(), as_dict=True)
+ jwk.update({"kid": kid, "alg": "ES256", "use": "sig"})
+ return private_key, {"keys": [jwk]}
+
+
+def create_es256_token(payload, private_key, kid: str = "test-key-1") -> str:
+ return jwt.encode(payload, private_key, algorithm="ES256", headers={"kid": kid})
+
+
+def jwks_config(mocker: MockerFixture):
+ """Configure both the legacy shared secret and a JWKS endpoint."""
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_VERIFY_KEY": MOCK_JWT_SECRET, "JWT_JWKS_URL": MOCK_JWKS_URL},
+ clear=True,
+ )
+ mocker.patch.object(config, "_settings", Settings())
+ mocker.patch.object(jwt_utils, "_jwks_client", None)
+ mocker.patch.object(jwt_utils, "_jwks_client_url", None)
+
+ private_key, jwk_set = make_es256_keypair()
+ mocker.patch.object(jwt.PyJWKClient, "fetch_data", return_value=jwk_set)
+ yield private_key
+
+
+def _post(token: str | None = None):
+ headers = {"Authorization": f"Bearer {token}"} if token else {}
+ return client.post("/guarded", headers=headers)
+
+
+def test_valid_service_token_is_accepted(jwks_config):
+ token = create_es256_token(SERVICE_PAYLOAD, jwks_config)
+ response = _post(token)
+ assert response.status_code == 200
+
+
+def test_scope_list_containing_required_scope_is_accepted(jwks_config):
+ payload = {**SERVICE_PAYLOAD, "scope": "other:scope auth-email:send"}
+ token = create_es256_token(payload, jwks_config)
+ assert _post(token).status_code == 200
+
+
+def test_missing_authorization_header_is_401(jwks_config):
+ assert _post().status_code == 401
+
+
+def test_user_token_is_rejected_as_service_token(jwks_config):
+ """A user token (aud=authenticated) must not open service endpoints."""
+ user_payload = {"sub": "user-123", "aud": "authenticated", "role": "admin"}
+ token = create_es256_token(user_payload, jwks_config)
+ assert _post(token).status_code == 401
+
+
+def test_wrong_subject_is_401(jwks_config):
+ payload = {**SERVICE_PAYLOAD, "sub": "service:imposter"}
+ token = create_es256_token(payload, jwks_config)
+ assert _post(token).status_code == 401
+
+
+def test_missing_scope_is_403(jwks_config):
+ payload = {**SERVICE_PAYLOAD, "scope": "other:scope"}
+ token = create_es256_token(payload, jwks_config)
+ assert _post(token).status_code == 403
+
+
+def test_symmetric_service_token_is_rejected(jwks_config):
+ """The legacy HS256 shared secret must not be able to mint service tokens."""
+ token = jwt.encode(SERVICE_PAYLOAD, MOCK_JWT_SECRET, algorithm="HS256")
+ response = _post(token)
+ assert response.status_code == 401
+ assert "symmetric" in response.json()["detail"]
+
+
+def test_expired_service_token_is_401(jwks_config):
+ payload = {
+ **SERVICE_PAYLOAD,
+ "exp": datetime.now(timezone.utc) - timedelta(minutes=1),
+ }
+ token = create_es256_token(payload, jwks_config)
+ assert _post(token).status_code == 401
+
+
+def test_garbage_token_is_401(jwks_config):
+ assert _post("not-a-jwt").status_code == 401
+
+
+# requires_frontend_service's "503 when JWT_JWKS_URL is unset" guard has no
+# test here: a valid Settings() cannot exist without JWT_JWKS_URL (its
+# validate() raises), so the guard is unreachable. config_test.py covers that
+# enforcement.
diff --git a/autogpt_platform/autogpt_libs/autogpt_libs/supabase_integration_credentials_store/types.py b/autogpt_platform/autogpt_libs/autogpt_libs/supabase_integration_credentials_store/types.py
deleted file mode 100644
index eb69ab2fac..0000000000
--- a/autogpt_platform/autogpt_libs/autogpt_libs/supabase_integration_credentials_store/types.py
+++ /dev/null
@@ -1,78 +0,0 @@
-from typing import Annotated, Any, Literal, Optional, TypedDict
-from uuid import uuid4
-
-from pydantic import BaseModel, Field, SecretStr, field_serializer
-
-
-class _BaseCredentials(BaseModel):
- id: str = Field(default_factory=lambda: str(uuid4()))
- provider: str
- title: Optional[str]
-
- @field_serializer("*")
- def dump_secret_strings(value: Any, _info):
- if isinstance(value, SecretStr):
- return value.get_secret_value()
- return value
-
-
-class OAuth2Credentials(_BaseCredentials):
- type: Literal["oauth2"] = "oauth2"
- username: Optional[str]
- """Username of the third-party service user that these credentials belong to"""
- access_token: SecretStr
- access_token_expires_at: Optional[int]
- """Unix timestamp (seconds) indicating when the access token expires (if at all)"""
- refresh_token: Optional[SecretStr]
- refresh_token_expires_at: Optional[int]
- """Unix timestamp (seconds) indicating when the refresh token expires (if at all)"""
- scopes: list[str]
- metadata: dict[str, Any] = Field(default_factory=dict)
-
- def bearer(self) -> str:
- return f"Bearer {self.access_token.get_secret_value()}"
-
-
-class APIKeyCredentials(_BaseCredentials):
- type: Literal["api_key"] = "api_key"
- api_key: SecretStr
- expires_at: Optional[int]
- """Unix timestamp (seconds) indicating when the API key expires (if at all)"""
-
- def bearer(self) -> str:
- return f"Bearer {self.api_key.get_secret_value()}"
-
-
-Credentials = Annotated[
- OAuth2Credentials | APIKeyCredentials,
- Field(discriminator="type"),
-]
-
-
-CredentialsType = Literal["api_key", "oauth2"]
-
-
-class OAuthState(BaseModel):
- token: str
- provider: str
- expires_at: int
- code_verifier: Optional[str] = None
- scopes: list[str]
- """Unix timestamp (seconds) indicating when this OAuth state expires"""
- credential_id: Optional[str] = None
- """If set, this OAuth flow upgrades an existing credential's scopes."""
-
-
-class UserMetadata(BaseModel):
- integration_credentials: list[Credentials] = Field(default_factory=list)
- integration_oauth_states: list[OAuthState] = Field(default_factory=list)
-
-
-class UserMetadataRaw(TypedDict, total=False):
- integration_credentials: list[dict]
- integration_oauth_states: list[dict]
-
-
-class UserIntegrations(BaseModel):
- credentials: list[Credentials] = Field(default_factory=list)
- oauth_states: list[OAuthState] = Field(default_factory=list)
diff --git a/autogpt_platform/autogpt_libs/poetry.lock b/autogpt_platform/autogpt_libs/poetry.lock
index 73d6142f8d..a8fcbf7cf0 100644
--- a/autogpt_platform/autogpt_libs/poetry.lock
+++ b/autogpt_platform/autogpt_libs/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand.
+# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand.
[[package]]
name = "annotated-doc"
@@ -30,7 +30,7 @@ version = "4.9.0"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
optional = false
python-versions = ">=3.9"
-groups = ["main"]
+groups = ["main", "dev"]
files = [
{file = "anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"},
{file = "anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028"},
@@ -67,7 +67,7 @@ description = "Backport of asyncio.Runner, a context manager that controls event
optional = false
python-versions = "<3.11,>=3.8"
groups = ["dev"]
-markers = "python_version == \"3.10\""
+markers = "python_version < \"3.11\""
files = [
{file = "backports_asyncio_runner-1.2.0-py3-none-any.whl", hash = "sha256:0da0a936a8aeb554eccb426dc55af3ba63bcdc69fa1a600b5bb305413a4477b5"},
{file = "backports_asyncio_runner-1.2.0.tar.gz", hash = "sha256:a5aa7b2b7d8f8bfcaa2b57313f70792df84e32a2a746f585213373f900b42162"},
@@ -91,7 +91,7 @@ version = "2025.7.14"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.7"
-groups = ["main"]
+groups = ["main", "dev"]
files = [
{file = "certifi-2025.7.14-py3-none-any.whl", hash = "sha256:6b31f564a415d79ee77df69d757bb49a5bb53bd9f756cbbe24394ffd6fc1f4b2"},
{file = "certifi-2025.7.14.tar.gz", hash = "sha256:8ea99dbdfaaf2ba2f9bac77b9249ef62ec5218e7c2b2e903378ed5fccf765995"},
@@ -297,21 +297,6 @@ files = [
{file = "charset_normalizer-3.4.2.tar.gz", hash = "sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63"},
]
-[[package]]
-name = "click"
-version = "8.2.1"
-description = "Composable command line interface toolkit"
-optional = false
-python-versions = ">=3.10"
-groups = ["main"]
-files = [
- {file = "click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b"},
- {file = "click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202"},
-]
-
-[package.dependencies]
-colorama = {version = "*", markers = "platform_system == \"Windows\""}
-
[[package]]
name = "colorama"
version = "0.4.6"
@@ -519,21 +504,6 @@ ssh = ["bcrypt (>=3.1.5)"]
test = ["certifi (>=2024)", "cryptography-vectors (==46.0.5)", "pretend (>=0.7)", "pytest (>=7.4.0)", "pytest-benchmark (>=4.0)", "pytest-cov (>=2.10.1)", "pytest-xdist (>=3.5.0)"]
test-randomorder = ["pytest-randomly"]
-[[package]]
-name = "deprecation"
-version = "2.1.0"
-description = "A library to handle automated deprecations"
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "deprecation-2.1.0-py2.py3-none-any.whl", hash = "sha256:a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a"},
- {file = "deprecation-2.1.0.tar.gz", hash = "sha256:72b3bde64e5d778694b0cf68178aed03d15e15477116add3fb773e581f9518ff"},
-]
-
-[package.dependencies]
-packaging = "*"
-
[[package]]
name = "exceptiongroup"
version = "1.3.0"
@@ -541,7 +511,7 @@ description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
groups = ["main", "dev"]
-markers = "python_version == \"3.10\""
+markers = "python_version < \"3.11\""
files = [
{file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"},
{file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"},
@@ -592,46 +562,6 @@ all = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.8)", "httpx (>
standard = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.8)", "httpx (>=0.23.0,<1.0.0)", "jinja2 (>=3.1.5)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.18)", "uvicorn[standard] (>=0.12.0)"]
standard-no-fastapi-cloud-cli = ["email-validator (>=2.0.0)", "fastapi-cli[standard-no-fastapi-cloud-cli] (>=0.0.8)", "httpx (>=0.23.0,<1.0.0)", "jinja2 (>=3.1.5)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.18)", "uvicorn[standard] (>=0.12.0)"]
-[[package]]
-name = "fsspec"
-version = "2026.1.0"
-description = "File-system specification"
-optional = false
-python-versions = ">=3.10"
-groups = ["main"]
-files = [
- {file = "fsspec-2026.1.0-py3-none-any.whl", hash = "sha256:cb76aa913c2285a3b49bdd5fc55b1d7c708d7208126b60f2eb8194fe1b4cbdcc"},
- {file = "fsspec-2026.1.0.tar.gz", hash = "sha256:e987cb0496a0d81bba3a9d1cee62922fb395e7d4c3b575e57f547953334fe07b"},
-]
-
-[package.extras]
-abfs = ["adlfs"]
-adl = ["adlfs"]
-arrow = ["pyarrow (>=1)"]
-dask = ["dask", "distributed"]
-dev = ["pre-commit", "ruff (>=0.5)"]
-doc = ["numpydoc", "sphinx", "sphinx-design", "sphinx-rtd-theme", "yarl"]
-dropbox = ["dropbox", "dropboxdrivefs", "requests"]
-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs (>2024.2.0)", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs (>2024.2.0)", "smbprotocol", "tqdm"]
-fuse = ["fusepy"]
-gcs = ["gcsfs"]
-git = ["pygit2"]
-github = ["requests"]
-gs = ["gcsfs"]
-gui = ["panel"]
-hdfs = ["pyarrow (>=1)"]
-http = ["aiohttp (!=4.0.0a0,!=4.0.0a1)"]
-libarchive = ["libarchive-c"]
-oci = ["ocifs"]
-s3 = ["s3fs"]
-sftp = ["paramiko"]
-smb = ["smbprotocol"]
-ssh = ["paramiko"]
-test = ["aiohttp (!=4.0.0a0,!=4.0.0a1)", "numpy", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "requests"]
-test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto[server] (>4,<5)", "pytest-timeout", "xarray"]
-test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "backports-zstd ; python_version < \"3.14\"", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr"]
-tqdm = ["tqdm"]
-
[[package]]
name = "google-api-core"
version = "2.25.1"
@@ -901,47 +831,19 @@ version = "0.16.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
optional = false
python-versions = ">=3.8"
-groups = ["main"]
+groups = ["dev"]
files = [
{file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"},
{file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"},
]
-[[package]]
-name = "h2"
-version = "4.2.0"
-description = "Pure-Python HTTP/2 protocol implementation"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "h2-4.2.0-py3-none-any.whl", hash = "sha256:479a53ad425bb29af087f3458a61d30780bc818e4ebcf01f0b536ba916462ed0"},
- {file = "h2-4.2.0.tar.gz", hash = "sha256:c8a52129695e88b1a0578d8d2cc6842bbd79128ac685463b887ee278126ad01f"},
-]
-
-[package.dependencies]
-hpack = ">=4.1,<5"
-hyperframe = ">=6.1,<7"
-
-[[package]]
-name = "hpack"
-version = "4.1.0"
-description = "Pure-Python HPACK header encoding"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "hpack-4.1.0-py3-none-any.whl", hash = "sha256:157ac792668d995c657d93111f46b4535ed114f0c9c8d672271bbec7eae1b496"},
- {file = "hpack-4.1.0.tar.gz", hash = "sha256:ec5eca154f7056aa06f196a557655c5b009b382873ac8d1e66e79e87535f1dca"},
-]
-
[[package]]
name = "httpcore"
version = "1.0.9"
description = "A minimal low-level HTTP client."
optional = false
python-versions = ">=3.8"
-groups = ["main"]
+groups = ["dev"]
files = [
{file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"},
{file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"},
@@ -963,7 +865,7 @@ version = "0.28.1"
description = "The next generation HTTP client."
optional = false
python-versions = ">=3.8"
-groups = ["main"]
+groups = ["dev"]
files = [
{file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"},
{file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"},
@@ -972,7 +874,6 @@ files = [
[package.dependencies]
anyio = "*"
certifi = "*"
-h2 = {version = ">=3,<5", optional = true, markers = "extra == \"http2\""}
httpcore = "==1.*"
idna = "*"
@@ -983,25 +884,13 @@ http2 = ["h2 (>=3,<5)"]
socks = ["socksio (==1.*)"]
zstd = ["zstandard (>=0.18.0)"]
-[[package]]
-name = "hyperframe"
-version = "6.1.0"
-description = "Pure-Python HTTP/2 framing"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "hyperframe-6.1.0-py3-none-any.whl", hash = "sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5"},
- {file = "hyperframe-6.1.0.tar.gz", hash = "sha256:f630908a00854a7adeabd6382b43923a4c4cd4b821fcb527e6ab9e15382a3b08"},
-]
-
[[package]]
name = "idna"
version = "3.10"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.6"
-groups = ["main"]
+groups = ["main", "dev"]
files = [
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
@@ -1046,381 +935,6 @@ files = [
{file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"},
]
-[[package]]
-name = "launchdarkly-eventsource"
-version = "1.5.1"
-description = "LaunchDarkly SSE Client"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "launchdarkly_eventsource-1.5.1-py3-none-any.whl", hash = "sha256:43dfbc14a3962c9bce252320d690cdcbfda0ca00501226d517ae77e60f570d44"},
- {file = "launchdarkly_eventsource-1.5.1.tar.gz", hash = "sha256:f122f80b36db6ea1ab20af62c82b8b2668682259b415053c94400dd6c07922a7"},
-]
-
-[package.dependencies]
-urllib3 = ">=1.26.0,<3"
-
-[[package]]
-name = "launchdarkly-server-sdk"
-version = "9.15.0"
-description = "LaunchDarkly SDK for Python"
-optional = false
-python-versions = ">=3.10"
-groups = ["main"]
-files = [
- {file = "launchdarkly_server_sdk-9.15.0-py3-none-any.whl", hash = "sha256:c267e29bfa3fb5e2a06a208448ada6ed5557a2924979b8d79c970b45d227c668"},
- {file = "launchdarkly_server_sdk-9.15.0.tar.gz", hash = "sha256:f31441b74bc1a69c381db57c33116509e407a2612628ad6dff0a7dbb39d5020b"},
-]
-
-[package.dependencies]
-certifi = ">=2018.4.16"
-expiringdict = ">=1.1.4"
-launchdarkly-eventsource = ">=1.5.0,<2.0.0"
-pyRFC3339 = ">=1.0"
-semver = ">=2.10.2"
-urllib3 = ">=1.26.0,<3"
-
-[package.extras]
-consul = ["python-consul (>=1.0.1)"]
-dynamodb = ["boto3 (>=1.9.71)"]
-redis = ["redis (>=2.10.5)"]
-test-filesource = ["pyyaml (>=5.3.1)", "watchdog (>=3.0.0)"]
-
-[[package]]
-name = "markdown-it-py"
-version = "4.0.0"
-description = "Python port of markdown-it. Markdown parsing, done right!"
-optional = false
-python-versions = ">=3.10"
-groups = ["main"]
-files = [
- {file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"},
- {file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"},
-]
-
-[package.dependencies]
-mdurl = ">=0.1,<1.0"
-
-[package.extras]
-benchmarking = ["psutil", "pytest", "pytest-benchmark"]
-compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "markdown-it-pyrs", "mistletoe (>=1.0,<2.0)", "mistune (>=3.0,<4.0)", "panflute (>=2.3,<3.0)"]
-linkify = ["linkify-it-py (>=1,<3)"]
-plugins = ["mdit-py-plugins (>=0.5.0)"]
-profiling = ["gprof2dot"]
-rtd = ["ipykernel", "jupyter_sphinx", "mdit-py-plugins (>=0.5.0)", "myst-parser", "pyyaml", "sphinx", "sphinx-book-theme (>=1.0,<2.0)", "sphinx-copybutton", "sphinx-design"]
-testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions", "requests"]
-
-[[package]]
-name = "mdurl"
-version = "0.1.2"
-description = "Markdown URL utilities"
-optional = false
-python-versions = ">=3.7"
-groups = ["main"]
-files = [
- {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
- {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
-]
-
-[[package]]
-name = "mmh3"
-version = "5.2.0"
-description = "Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "mmh3-5.2.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:81c504ad11c588c8629536b032940f2a359dda3b6cbfd4ad8f74cb24dcd1b0bc"},
- {file = "mmh3-5.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0b898cecff57442724a0f52bf42c2de42de63083a91008fb452887e372f9c328"},
- {file = "mmh3-5.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:be1374df449465c9f2500e62eee73a39db62152a8bdfbe12ec5b5c1cd451344d"},
- {file = "mmh3-5.2.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:b0d753ad566c721faa33db7e2e0eddd74b224cdd3eaf8481d76c926603c7a00e"},
- {file = "mmh3-5.2.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dfbead5575f6470c17e955b94f92d62a03dfc3d07f2e6f817d9b93dc211a1515"},
- {file = "mmh3-5.2.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7434a27754049144539d2099a6d2da5d88b8bdeedf935180bf42ad59b3607aa3"},
- {file = "mmh3-5.2.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:cadc16e8ea64b5d9a47363013e2bea469e121e6e7cb416a7593aeb24f2ad122e"},
- {file = "mmh3-5.2.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d765058da196f68dc721116cab335e696e87e76720e6ef8ee5a24801af65e63d"},
- {file = "mmh3-5.2.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:8b0c53fe0994beade1ad7c0f13bd6fec980a0664bfbe5a6a7d64500b9ab76772"},
- {file = "mmh3-5.2.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:49037d417419863b222ae47ee562b2de9c3416add0a45c8d7f4e864be8dc4f89"},
- {file = "mmh3-5.2.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:6ecb4e750d712abde046858ee6992b65c93f1f71b397fce7975c3860c07365d2"},
- {file = "mmh3-5.2.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:382a6bb3f8c6532ea084e7acc5be6ae0c6effa529240836d59352398f002e3fc"},
- {file = "mmh3-5.2.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7733ec52296fc1ba22e9b90a245c821adbb943e98c91d8a330a2254612726106"},
- {file = "mmh3-5.2.0-cp310-cp310-win32.whl", hash = "sha256:127c95336f2a98c51e7682341ab7cb0be3adb9df0819ab8505a726ed1801876d"},
- {file = "mmh3-5.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:419005f84ba1cab47a77465a2a843562dadadd6671b8758bf179d82a15ca63eb"},
- {file = "mmh3-5.2.0-cp310-cp310-win_arm64.whl", hash = "sha256:d22c9dcafed659fadc605538946c041722b6d1104fe619dbf5cc73b3c8a0ded8"},
- {file = "mmh3-5.2.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7901c893e704ee3c65f92d39b951f8f34ccf8e8566768c58103fb10e55afb8c1"},
- {file = "mmh3-5.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4a5f5536b1cbfa72318ab3bfc8a8188b949260baed186b75f0abc75b95d8c051"},
- {file = "mmh3-5.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:cedac4f4054b8f7859e5aed41aaa31ad03fce6851901a7fdc2af0275ac533c10"},
- {file = "mmh3-5.2.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:eb756caf8975882630ce4e9fbbeb9d3401242a72528230422c9ab3a0d278e60c"},
- {file = "mmh3-5.2.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:097e13c8b8a66c5753c6968b7640faefe85d8e38992703c1f666eda6ef4c3762"},
- {file = "mmh3-5.2.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a7c0c7845566b9686480e6a7e9044db4afb60038d5fabd19227443f0104eeee4"},
- {file = "mmh3-5.2.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:61ac226af521a572700f863d6ecddc6ece97220ce7174e311948ff8c8919a363"},
- {file = "mmh3-5.2.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:582f9dbeefe15c32a5fa528b79b088b599a1dfe290a4436351c6090f90ddebb8"},
- {file = "mmh3-5.2.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2ebfc46b39168ab1cd44670a32ea5489bcbc74a25795c61b6d888c5c2cf654ed"},
- {file = "mmh3-5.2.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1556e31e4bd0ac0c17eaf220be17a09c171d7396919c3794274cb3415a9d3646"},
- {file = "mmh3-5.2.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:81df0dae22cd0da87f1c978602750f33d17fb3d21fb0f326c89dc89834fea79b"},
- {file = "mmh3-5.2.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:eba01ec3bd4a49b9ac5ca2bc6a73ff5f3af53374b8556fcc2966dd2af9eb7779"},
- {file = "mmh3-5.2.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e9a011469b47b752e7d20de296bb34591cdfcbe76c99c2e863ceaa2aa61113d2"},
- {file = "mmh3-5.2.0-cp311-cp311-win32.whl", hash = "sha256:bc44fc2b886243d7c0d8daeb37864e16f232e5b56aaec27cc781d848264cfd28"},
- {file = "mmh3-5.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:8ebf241072cf2777a492d0e09252f8cc2b3edd07dfdb9404b9757bffeb4f2cee"},
- {file = "mmh3-5.2.0-cp311-cp311-win_arm64.whl", hash = "sha256:b5f317a727bba0e633a12e71228bc6a4acb4f471a98b1c003163b917311ea9a9"},
- {file = "mmh3-5.2.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:384eda9361a7bf83a85e09447e1feafe081034af9dd428893701b959230d84be"},
- {file = "mmh3-5.2.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:2c9da0d568569cc87315cb063486d761e38458b8ad513fedd3dc9263e1b81bcd"},
- {file = "mmh3-5.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:86d1be5d63232e6eb93c50881aea55ff06eb86d8e08f9b5417c8c9b10db9db96"},
- {file = "mmh3-5.2.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:bf7bee43e17e81671c447e9c83499f53d99bf440bc6d9dc26a841e21acfbe094"},
- {file = "mmh3-5.2.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7aa18cdb58983ee660c9c400b46272e14fa253c675ed963d3812487f8ca42037"},
- {file = "mmh3-5.2.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ae9d032488fcec32d22be6542d1a836f00247f40f320844dbb361393b5b22773"},
- {file = "mmh3-5.2.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e1861fb6b1d0453ed7293200139c0a9011eeb1376632e048e3766945b13313c5"},
- {file = "mmh3-5.2.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:99bb6a4d809aa4e528ddfe2c85dd5239b78b9dd14be62cca0329db78505e7b50"},
- {file = "mmh3-5.2.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1f8d8b627799f4e2fcc7c034fed8f5f24dc7724ff52f69838a3d6d15f1ad4765"},
- {file = "mmh3-5.2.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b5995088dd7023d2d9f310a0c67de5a2b2e06a570ecfd00f9ff4ab94a67cde43"},
- {file = "mmh3-5.2.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1a5f4d2e59d6bba8ef01b013c472741835ad961e7c28f50c82b27c57748744a4"},
- {file = "mmh3-5.2.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:fd6e6c3d90660d085f7e73710eab6f5545d4854b81b0135a3526e797009dbda3"},
- {file = "mmh3-5.2.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c4a2f3d83879e3de2eb8cbf562e71563a8ed15ee9b9c2e77ca5d9f73072ac15c"},
- {file = "mmh3-5.2.0-cp312-cp312-win32.whl", hash = "sha256:2421b9d665a0b1ad724ec7332fb5a98d075f50bc51a6ff854f3a1882bd650d49"},
- {file = "mmh3-5.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:72d80005b7634a3a2220f81fbeb94775ebd12794623bb2e1451701ea732b4aa3"},
- {file = "mmh3-5.2.0-cp312-cp312-win_arm64.whl", hash = "sha256:3d6bfd9662a20c054bc216f861fa330c2dac7c81e7fb8307b5e32ab5b9b4d2e0"},
- {file = "mmh3-5.2.0-cp313-cp313-android_21_arm64_v8a.whl", hash = "sha256:e79c00eba78f7258e5b354eccd4d7907d60317ced924ea4a5f2e9d83f5453065"},
- {file = "mmh3-5.2.0-cp313-cp313-android_21_x86_64.whl", hash = "sha256:956127e663d05edbeec54df38885d943dfa27406594c411139690485128525de"},
- {file = "mmh3-5.2.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:c3dca4cb5b946ee91b3d6bb700d137b1cd85c20827f89fdf9c16258253489044"},
- {file = "mmh3-5.2.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:e651e17bfde5840e9e4174b01e9e080ce49277b70d424308b36a7969d0d1af73"},
- {file = "mmh3-5.2.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:9f64bf06f4bf623325fda3a6d02d36cd69199b9ace99b04bb2d7fd9f89688504"},
- {file = "mmh3-5.2.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ddc63328889bcaee77b743309e5c7d2d52cee0d7d577837c91b6e7cc9e755e0b"},
- {file = "mmh3-5.2.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bb0fdc451fb6d86d81ab8f23d881b8d6e37fc373a2deae1c02d27002d2ad7a05"},
- {file = "mmh3-5.2.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b29044e1ffdb84fe164d0a7ea05c7316afea93c00f8ed9449cf357c36fc4f814"},
- {file = "mmh3-5.2.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:58981d6ea9646dbbf9e59a30890cbf9f610df0e4a57dbfe09215116fd90b0093"},
- {file = "mmh3-5.2.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7e5634565367b6d98dc4aa2983703526ef556b3688ba3065edb4b9b90ede1c54"},
- {file = "mmh3-5.2.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b0271ac12415afd3171ab9a3c7cbfc71dee2c68760a7dc9d05bf8ed6ddfa3a7a"},
- {file = "mmh3-5.2.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:45b590e31bc552c6f8e2150ff1ad0c28dd151e9f87589e7eaf508fbdd8e8e908"},
- {file = "mmh3-5.2.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bdde97310d59604f2a9119322f61b31546748499a21b44f6715e8ced9308a6c5"},
- {file = "mmh3-5.2.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:fc9c5f280438cf1c1a8f9abb87dc8ce9630a964120cfb5dd50d1e7ce79690c7a"},
- {file = "mmh3-5.2.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:c903e71fd8debb35ad2a4184c1316b3cb22f64ce517b4e6747f25b0a34e41266"},
- {file = "mmh3-5.2.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:eed4bba7ff8a0d37106ba931ab03bdd3915fbb025bcf4e1f0aa02bc8114960c5"},
- {file = "mmh3-5.2.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:1fdb36b940e9261aff0b5177c5b74a36936b902f473180f6c15bde26143681a9"},
- {file = "mmh3-5.2.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7303aab41e97adcf010a09efd8f1403e719e59b7705d5e3cfed3dd7571589290"},
- {file = "mmh3-5.2.0-cp313-cp313-win32.whl", hash = "sha256:03e08c6ebaf666ec1e3d6ea657a2d363bb01effd1a9acfe41f9197decaef0051"},
- {file = "mmh3-5.2.0-cp313-cp313-win_amd64.whl", hash = "sha256:7fddccd4113e7b736706e17a239a696332360cbaddf25ae75b57ba1acce65081"},
- {file = "mmh3-5.2.0-cp313-cp313-win_arm64.whl", hash = "sha256:fa0c966ee727aad5406d516375593c5f058c766b21236ab8985693934bb5085b"},
- {file = "mmh3-5.2.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:e5015f0bb6eb50008bed2d4b1ce0f2a294698a926111e4bb202c0987b4f89078"},
- {file = "mmh3-5.2.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:e0f3ed828d709f5b82d8bfe14f8856120718ec4bd44a5b26102c3030a1e12501"},
- {file = "mmh3-5.2.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:f35727c5118aba95f0397e18a1a5b8405425581bfe53e821f0fb444cbdc2bc9b"},
- {file = "mmh3-5.2.0-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:3bc244802ccab5220008cb712ca1508cb6a12f0eb64ad62997156410579a1770"},
- {file = "mmh3-5.2.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:ff3d50dc3fe8a98059f99b445dfb62792b5d006c5e0b8f03c6de2813b8376110"},
- {file = "mmh3-5.2.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:37a358cc881fe796e099c1db6ce07ff757f088827b4e8467ac52b7a7ffdca647"},
- {file = "mmh3-5.2.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:b9a87025121d1c448f24f27ff53a5fe7b6ef980574b4a4f11acaabe702420d63"},
- {file = "mmh3-5.2.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1ba55d6ca32eeef8b2625e1e4bfc3b3db52bc63014bd7e5df8cc11bf2b036b12"},
- {file = "mmh3-5.2.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c9ff37ba9f15637e424c2ab57a1a590c52897c845b768e4e0a4958084ec87f22"},
- {file = "mmh3-5.2.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a094319ec0db52a04af9fdc391b4d39a1bc72bc8424b47c4411afb05413a44b5"},
- {file = "mmh3-5.2.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:c5584061fd3da584659b13587f26c6cad25a096246a481636d64375d0c1f6c07"},
- {file = "mmh3-5.2.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ecbfc0437ddfdced5e7822d1ce4855c9c64f46819d0fdc4482c53f56c707b935"},
- {file = "mmh3-5.2.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:7b986d506a8e8ea345791897ba5d8ba0d9d8820cd4fc3e52dbe6de19388de2e7"},
- {file = "mmh3-5.2.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:38d899a156549da8ef6a9f1d6f7ef231228d29f8f69bce2ee12f5fba6d6fd7c5"},
- {file = "mmh3-5.2.0-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:d86651fa45799530885ba4dab3d21144486ed15285e8784181a0ab37a4552384"},
- {file = "mmh3-5.2.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:c463d7c1c4cfc9d751efeaadd936bbba07b5b0ed81a012b3a9f5a12f0872bd6e"},
- {file = "mmh3-5.2.0-cp314-cp314-win32.whl", hash = "sha256:bb4fe46bdc6104fbc28db7a6bacb115ee6368ff993366bbd8a2a7f0076e6f0c0"},
- {file = "mmh3-5.2.0-cp314-cp314-win_amd64.whl", hash = "sha256:7c7f0b342fd06044bedd0b6e72177ddc0076f54fd89ee239447f8b271d919d9b"},
- {file = "mmh3-5.2.0-cp314-cp314-win_arm64.whl", hash = "sha256:3193752fc05ea72366c2b63ff24b9a190f422e32d75fdeae71087c08fff26115"},
- {file = "mmh3-5.2.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:69fc339d7202bea69ef9bd7c39bfdf9fdabc8e6822a01eba62fb43233c1b3932"},
- {file = "mmh3-5.2.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:12da42c0a55c9d86ab566395324213c319c73ecb0c239fad4726324212b9441c"},
- {file = "mmh3-5.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f7f9034c7cf05ddfaac8d7a2e63a3c97a840d4615d0a0e65ba8bdf6f8576e3be"},
- {file = "mmh3-5.2.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:11730eeb16dfcf9674fdea9bb6b8e6dd9b40813b7eb839bc35113649eef38aeb"},
- {file = "mmh3-5.2.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:932a6eec1d2e2c3c9e630d10f7128d80e70e2d47fe6b8c7ea5e1afbd98733e65"},
- {file = "mmh3-5.2.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3ca975c51c5028947bbcfc24966517aac06a01d6c921e30f7c5383c195f87991"},
- {file = "mmh3-5.2.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5b0b58215befe0f0e120b828f7645e97719bbba9f23b69e268ed0ac7adde8645"},
- {file = "mmh3-5.2.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:29c2b9ce61886809d0492a274a5a53047742dea0f703f9c4d5d223c3ea6377d3"},
- {file = "mmh3-5.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:a367d4741ac0103f8198c82f429bccb9359f543ca542b06a51f4f0332e8de279"},
- {file = "mmh3-5.2.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:5a5dba98e514fb26241868f6eb90a7f7ca0e039aed779342965ce24ea32ba513"},
- {file = "mmh3-5.2.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:941603bfd75a46023807511c1ac2f1b0f39cccc393c15039969806063b27e6db"},
- {file = "mmh3-5.2.0-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:132dd943451a7c7546978863d2f5a64977928410782e1a87d583cb60eb89e667"},
- {file = "mmh3-5.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f698733a8a494466432d611a8f0d1e026f5286dee051beea4b3c3146817e35d5"},
- {file = "mmh3-5.2.0-cp314-cp314t-win32.whl", hash = "sha256:6d541038b3fc360ec538fc116de87462627944765a6750308118f8b509a8eec7"},
- {file = "mmh3-5.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:e912b19cf2378f2967d0c08e86ff4c6c360129887f678e27e4dde970d21b3f4d"},
- {file = "mmh3-5.2.0-cp314-cp314t-win_arm64.whl", hash = "sha256:e7884931fe5e788163e7b3c511614130c2c59feffdc21112290a194487efb2e9"},
- {file = "mmh3-5.2.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3c6041fd9d5fb5fcac57d5c80f521a36b74aea06b8566431c63e4ffc49aced51"},
- {file = "mmh3-5.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:58477cf9ef16664d1ce2b038f87d2dc96d70fe50733a34a7f07da6c9a5e3538c"},
- {file = "mmh3-5.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:be7d3dca9358e01dab1bad881fb2b4e8730cec58d36dd44482bc068bfcd3bc65"},
- {file = "mmh3-5.2.0-cp39-cp39-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:931d47e08c9c8a67bf75d82f0ada8399eac18b03388818b62bfa42882d571d72"},
- {file = "mmh3-5.2.0-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:dd966df3489ec13848d6c6303429bbace94a153f43d1ae2a55115fd36fd5ca5d"},
- {file = "mmh3-5.2.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c677d78887244bf3095020b73c42b505b700f801c690f8eaa90ad12d3179612f"},
- {file = "mmh3-5.2.0-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:63830f846797187c5d3e2dae50f0848fdc86032f5bfdc58ae352f02f857e9025"},
- {file = "mmh3-5.2.0-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:c3f563e8901960e2eaa64c8e8821895818acabeb41c96f2efbb936f65dbe486c"},
- {file = "mmh3-5.2.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:96f1e1ac44cbb42bcc406e509f70c9af42c594e72ccc7b1257f97554204445f0"},
- {file = "mmh3-5.2.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:7bbb0df897944b5ec830f3ad883e32c5a7375370a521565f5fe24443bfb2c4f7"},
- {file = "mmh3-5.2.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:1fae471339ae1b9c641f19cf46dfe6ffd7f64b1fba7c4333b99fa3dd7f21ae0a"},
- {file = "mmh3-5.2.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:aa6e5d31fdc5ed9e3e95f9873508615a778fe9b523d52c17fc770a3eb39ab6e4"},
- {file = "mmh3-5.2.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:746a5ee71c6d1103d9b560fa147881b5e68fd35da56e54e03d5acefad0e7c055"},
- {file = "mmh3-5.2.0-cp39-cp39-win32.whl", hash = "sha256:10983c10f5c77683bd845751905ba535ec47409874acc759d5ce3ff7ef34398a"},
- {file = "mmh3-5.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:fdfd3fb739f4e22746e13ad7ba0c6eedf5f454b18d11249724a388868e308ee4"},
- {file = "mmh3-5.2.0-cp39-cp39-win_arm64.whl", hash = "sha256:33576136c06b46a7046b6d83a3d75fbca7d25f84cec743f1ae156362608dc6d2"},
- {file = "mmh3-5.2.0.tar.gz", hash = "sha256:1efc8fec8478e9243a78bb993422cf79f8ff85cb4cf6b79647480a31e0d950a8"},
-]
-
-[package.extras]
-benchmark = ["pymmh3 (==0.0.5)", "pyperf (==2.9.0)", "xxhash (==3.5.0)"]
-docs = ["myst-parser (==4.0.1)", "shibuya (==2025.7.24)", "sphinx (==8.2.3)", "sphinx-copybutton (==0.5.2)"]
-lint = ["black (==25.1.0)", "clang-format (==20.1.8)", "isort (==6.0.1)", "pylint (==3.3.7)"]
-plot = ["matplotlib (==3.10.3)", "pandas (==2.3.1)"]
-test = ["pytest (==8.4.1)", "pytest-sugar (==1.0.0)"]
-type = ["mypy (==1.17.0)"]
-
-[[package]]
-name = "multidict"
-version = "6.7.1"
-description = "multidict implementation"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "multidict-6.7.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c93c3db7ea657dd4637d57e74ab73de31bccefe144d3d4ce370052035bc85fb5"},
- {file = "multidict-6.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:974e72a2474600827abaeda71af0c53d9ebbc3c2eb7da37b37d7829ae31232d8"},
- {file = "multidict-6.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cdea2e7b2456cfb6694fb113066fd0ec7ea4d67e3a35e1f4cbeea0b448bf5872"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:17207077e29342fdc2c9a82e4b306f1127bf1ea91f8b71e02d4798a70bb99991"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d4f49cb5661344764e4c7c7973e92a47a59b8fc19b6523649ec9dc4960e58a03"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a9fc4caa29e2e6ae408d1c450ac8bf19892c5fca83ee634ecd88a53332c59981"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c5f0c21549ab432b57dcc82130f388d84ad8179824cc3f223d5e7cfbfd4143f6"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:7dfb78d966b2c906ae1d28ccf6e6712a3cd04407ee5088cd276fe8cb42186190"},
- {file = "multidict-6.7.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9b0d9b91d1aa44db9c1f1ecd0d9d2ae610b2f4f856448664e01a3b35899f3f92"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:dd96c01a9dcd4889dcfcf9eb5544ca0c77603f239e3ffab0524ec17aea9a93ee"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:067343c68cd6612d375710f895337b3a98a033c94f14b9a99eff902f205424e2"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5884a04f4ff56c6120f6ccf703bdeb8b5079d808ba604d4d53aec0d55dc33568"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:8affcf1c98b82bc901702eb73b6947a1bfa170823c153fe8a47b5f5f02e48e40"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:0d17522c37d03e85c8098ec8431636309b2682cf12e58f4dbc76121fb50e4962"},
- {file = "multidict-6.7.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:24c0cf81544ca5e17cfcb6e482e7a82cd475925242b308b890c9452a074d4505"},
- {file = "multidict-6.7.1-cp310-cp310-win32.whl", hash = "sha256:d82dd730a95e6643802f4454b8fdecdf08667881a9c5670db85bc5a56693f122"},
- {file = "multidict-6.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:cf37cbe5ced48d417ba045aca1b21bafca67489452debcde94778a576666a1df"},
- {file = "multidict-6.7.1-cp310-cp310-win_arm64.whl", hash = "sha256:59bc83d3f66b41dac1e7460aac1d196edc70c9ba3094965c467715a70ecb46db"},
- {file = "multidict-6.7.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7ff981b266af91d7b4b3793ca3382e53229088d193a85dfad6f5f4c27fc73e5d"},
- {file = "multidict-6.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:844c5bca0b5444adb44a623fb0a1310c2f4cd41f402126bb269cd44c9b3f3e1e"},
- {file = "multidict-6.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f2a0a924d4c2e9afcd7ec64f9de35fcd96915149b2216e1cb2c10a56df483855"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:8be1802715a8e892c784c0197c2ace276ea52702a0ede98b6310c8f255a5afb3"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2e2d2ed645ea29f31c4c7ea1552fcfd7cb7ba656e1eafd4134a6620c9f5fdd9e"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:95922cee9a778659e91db6497596435777bd25ed116701a4c034f8e46544955a"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6b83cabdc375ffaaa15edd97eb7c0c672ad788e2687004990074d7d6c9b140c8"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:38fb49540705369bab8484db0689d86c0a33a0a9f2c1b197f506b71b4b6c19b0"},
- {file = "multidict-6.7.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:439cbebd499f92e9aa6793016a8acaa161dfa749ae86d20960189f5398a19144"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6d3bc717b6fe763b8be3f2bee2701d3c8eb1b2a8ae9f60910f1b2860c82b6c49"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:619e5a1ac57986dbfec9f0b301d865dddf763696435e2962f6d9cf2fdff2bb71"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:0b38ebffd9be37c1170d33bc0f36f4f262e0a09bc1aac1c34c7aa51a7293f0b3"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:10ae39c9cfe6adedcdb764f5e8411d4a92b055e35573a2eaa88d3323289ef93c"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:25167cc263257660290fba06b9318d2026e3c910be240a146e1f66dd114af2b0"},
- {file = "multidict-6.7.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:128441d052254f42989ef98b7b6a6ecb1e6f708aa962c7984235316db59f50fa"},
- {file = "multidict-6.7.1-cp311-cp311-win32.whl", hash = "sha256:d62b7f64ffde3b99d06b707a280db04fb3855b55f5a06df387236051d0668f4a"},
- {file = "multidict-6.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:bdbf9f3b332abd0cdb306e7c2113818ab1e922dc84b8f8fd06ec89ed2a19ab8b"},
- {file = "multidict-6.7.1-cp311-cp311-win_arm64.whl", hash = "sha256:b8c990b037d2fff2f4e33d3f21b9b531c5745b33a49a7d6dbe7a177266af44f6"},
- {file = "multidict-6.7.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:a90f75c956e32891a4eda3639ce6dd86e87105271f43d43442a3aedf3cddf172"},
- {file = "multidict-6.7.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:3fccb473e87eaa1382689053e4a4618e7ba7b9b9b8d6adf2027ee474597128cd"},
- {file = "multidict-6.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b0fa96985700739c4c7853a43c0b3e169360d6855780021bfc6d0f1ce7c123e7"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cb2a55f408c3043e42b40cc8eecd575afa27b7e0b956dfb190de0f8499a57a53"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:eb0ce7b2a32d09892b3dd6cc44877a0d02a33241fafca5f25c8b6b62374f8b75"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c3a32d23520ee37bf327d1e1a656fec76a2edd5c038bf43eddfa0572ec49c60b"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9c90fed18bffc0189ba814749fdcc102b536e83a9f738a9003e569acd540a733"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:da62917e6076f512daccfbbde27f46fed1c98fee202f0559adec8ee0de67f71a"},
- {file = "multidict-6.7.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bfde23ef6ed9db7eaee6c37dcec08524cb43903c60b285b172b6c094711b3961"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3758692429e4e32f1ba0df23219cd0b4fc0a52f476726fff9337d1a57676a582"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:398c1478926eca669f2fd6a5856b6de9c0acf23a2cb59a14c0ba5844fa38077e"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:c102791b1c4f3ab36ce4101154549105a53dc828f016356b3e3bcae2e3a039d3"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:a088b62bd733e2ad12c50dad01b7d0166c30287c166e137433d3b410add807a6"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:3d51ff4785d58d3f6c91bdbffcb5e1f7ddfda557727043aa20d20ec4f65e324a"},
- {file = "multidict-6.7.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fc5907494fccf3e7d3f94f95c91d6336b092b5fc83811720fae5e2765890dfba"},
- {file = "multidict-6.7.1-cp312-cp312-win32.whl", hash = "sha256:28ca5ce2fd9716631133d0e9a9b9a745ad7f60bac2bccafb56aa380fc0b6c511"},
- {file = "multidict-6.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcee94dfbd638784645b066074b338bc9cc155d4b4bffa4adce1615c5a426c19"},
- {file = "multidict-6.7.1-cp312-cp312-win_arm64.whl", hash = "sha256:ba0a9fb644d0c1a2194cf7ffb043bd852cea63a57f66fbd33959f7dae18517bf"},
- {file = "multidict-6.7.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:2b41f5fed0ed563624f1c17630cb9941cf2309d4df00e494b551b5f3e3d67a23"},
- {file = "multidict-6.7.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:84e61e3af5463c19b67ced91f6c634effb89ef8bfc5ca0267f954451ed4bb6a2"},
- {file = "multidict-6.7.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:935434b9853c7c112eee7ac891bc4cb86455aa631269ae35442cb316790c1445"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:432feb25a1cb67fe82a9680b4d65fb542e4635cb3166cd9c01560651ad60f177"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e82d14e3c948952a1a85503817e038cba5905a3352de76b9a465075d072fba23"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4cfb48c6ea66c83bcaaf7e4dfa7ec1b6bbcf751b7db85a328902796dfde4c060"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1d540e51b7e8e170174555edecddbd5538105443754539193e3e1061864d444d"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:273d23f4b40f3dce4d6c8a821c741a86dec62cded82e1175ba3d99be128147ed"},
- {file = "multidict-6.7.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d624335fd4fa1c08a53f8b4be7676ebde19cd092b3895c421045ca87895b429"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:12fad252f8b267cc75b66e8fc51b3079604e8d43a75428ffe193cd9e2195dfd6"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:03ede2a6ffbe8ef936b92cb4529f27f42be7f56afcdab5ab739cd5f27fb1cbf9"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:90efbcf47dbe33dcf643a1e400d67d59abeac5db07dc3f27d6bdeae497a2198c"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5c4b9bfc148f5a91be9244d6264c53035c8a0dcd2f51f1c3c6e30e30ebaa1c84"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:401c5a650f3add2472d1d288c26deebc540f99e2fb83e9525007a74cd2116f1d"},
- {file = "multidict-6.7.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:97891f3b1b3ffbded884e2916cacf3c6fc87b66bb0dde46f7357404750559f33"},
- {file = "multidict-6.7.1-cp313-cp313-win32.whl", hash = "sha256:e1c5988359516095535c4301af38d8a8838534158f649c05dd1050222321bcb3"},
- {file = "multidict-6.7.1-cp313-cp313-win_amd64.whl", hash = "sha256:960c83bf01a95b12b08fd54324a4eb1d5b52c88932b5cba5d6e712bb3ed12eb5"},
- {file = "multidict-6.7.1-cp313-cp313-win_arm64.whl", hash = "sha256:563fe25c678aaba333d5399408f5ec3c383ca5b663e7f774dd179a520b8144df"},
- {file = "multidict-6.7.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:c76c4bec1538375dad9d452d246ca5368ad6e1c9039dadcf007ae59c70619ea1"},
- {file = "multidict-6.7.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:57b46b24b5d5ebcc978da4ec23a819a9402b4228b8a90d9c656422b4bdd8a963"},
- {file = "multidict-6.7.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e954b24433c768ce78ab7929e84ccf3422e46deb45a4dc9f93438f8217fa2d34"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:3bd231490fa7217cc832528e1cd8752a96f0125ddd2b5749390f7c3ec8721b65"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:253282d70d67885a15c8a7716f3a73edf2d635793ceda8173b9ecc21f2fb8292"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0b4c48648d7649c9335cf1927a8b87fa692de3dcb15faa676c6a6f1f1aabda43"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:98bc624954ec4d2c7cb074b8eefc2b5d0ce7d482e410df446414355d158fe4ca"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:1b99af4d9eec0b49927b4402bcbb58dea89d3e0db8806a4086117019939ad3dd"},
- {file = "multidict-6.7.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6aac4f16b472d5b7dc6f66a0d49dd57b0e0902090be16594dc9ebfd3d17c47e7"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:21f830fe223215dffd51f538e78c172ed7c7f60c9b96a2bf05c4848ad49921c3"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:f5dd81c45b05518b9aa4da4aa74e1c93d715efa234fd3e8a179df611cc85e5f4"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:eb304767bca2bb92fb9c5bd33cedc95baee5bb5f6c88e63706533a1c06ad08c8"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:c9035dde0f916702850ef66460bc4239d89d08df4d02023a5926e7446724212c"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:af959b9beeb66c822380f222f0e0a1889331597e81f1ded7f374f3ecb0fd6c52"},
- {file = "multidict-6.7.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:41f2952231456154ee479651491e94118229844dd7226541788be783be2b5108"},
- {file = "multidict-6.7.1-cp313-cp313t-win32.whl", hash = "sha256:df9f19c28adcb40b6aae30bbaa1478c389efd50c28d541d76760199fc1037c32"},
- {file = "multidict-6.7.1-cp313-cp313t-win_amd64.whl", hash = "sha256:d54ecf9f301853f2c5e802da559604b3e95bb7a3b01a9c295c6ee591b9882de8"},
- {file = "multidict-6.7.1-cp313-cp313t-win_arm64.whl", hash = "sha256:5a37ca18e360377cfda1d62f5f382ff41f2b8c4ccb329ed974cc2e1643440118"},
- {file = "multidict-6.7.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:8f333ec9c5eb1b7105e3b84b53141e66ca05a19a605368c55450b6ba208cb9ee"},
- {file = "multidict-6.7.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:a407f13c188f804c759fc6a9f88286a565c242a76b27626594c133b82883b5c2"},
- {file = "multidict-6.7.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:0e161ddf326db5577c3a4cc2d8648f81456e8a20d40415541587a71620d7a7d1"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:1e3a8bb24342a8201d178c3b4984c26ba81a577c80d4d525727427460a50c22d"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:97231140a50f5d447d3164f994b86a0bed7cd016e2682f8650d6a9158e14fd31"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:6b10359683bd8806a200fd2909e7c8ca3a7b24ec1d8132e483d58e791d881048"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:283ddac99f7ac25a4acadbf004cb5ae34480bbeb063520f70ce397b281859362"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:538cec1e18c067d0e6103aa9a74f9e832904c957adc260e61cd9d8cf0c3b3d37"},
- {file = "multidict-6.7.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7eee46ccb30ff48a1e35bb818cc90846c6be2b68240e42a78599166722cea709"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fa263a02f4f2dd2d11a7b1bb4362aa7cb1049f84a9235d31adf63f30143469a0"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:2e1425e2f99ec5bd36c15a01b690a1a2456209c5deed58f95469ffb46039ccbb"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:497394b3239fc6f0e13a78a3e1b61296e72bf1c5f94b4c4eb80b265c37a131cd"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:233b398c29d3f1b9676b4b6f75c518a06fcb2ea0b925119fb2c1bc35c05e1601"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:93b1818e4a6e0930454f0f2af7dfce69307ca03cdcfb3739bf4d91241967b6c1"},
- {file = "multidict-6.7.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f33dc2a3abe9249ea5d8360f969ec7f4142e7ac45ee7014d8f8d5acddf178b7b"},
- {file = "multidict-6.7.1-cp314-cp314-win32.whl", hash = "sha256:3ab8b9d8b75aef9df299595d5388b14530839f6422333357af1339443cff777d"},
- {file = "multidict-6.7.1-cp314-cp314-win_amd64.whl", hash = "sha256:5e01429a929600e7dab7b166062d9bb54a5eed752384c7384c968c2afab8f50f"},
- {file = "multidict-6.7.1-cp314-cp314-win_arm64.whl", hash = "sha256:4885cb0e817aef5d00a2e8451d4665c1808378dc27c2705f1bf4ef8505c0d2e5"},
- {file = "multidict-6.7.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:0458c978acd8e6ea53c81eefaddbbee9c6c5e591f41b3f5e8e194780fe026581"},
- {file = "multidict-6.7.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:c0abd12629b0af3cf590982c0b413b1e7395cd4ec026f30986818ab95bfaa94a"},
- {file = "multidict-6.7.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:14525a5f61d7d0c94b368a42cff4c9a4e7ba2d52e2672a7b23d84dc86fb02b0c"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:17307b22c217b4cf05033dabefe68255a534d637c6c9b0cc8382718f87be4262"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7a7e590ff876a3eaf1c02a4dfe0724b6e69a9e9de6d8f556816f29c496046e59"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:5fa6a95dfee63893d80a34758cd0e0c118a30b8dcb46372bf75106c591b77889"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a0543217a6a017692aa6ae5cc39adb75e587af0f3a82288b1492eb73dd6cc2a4"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f99fe611c312b3c1c0ace793f92464d8cd263cc3b26b5721950d977b006b6c4d"},
- {file = "multidict-6.7.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9004d8386d133b7e6135679424c91b0b854d2d164af6ea3f289f8f2761064609"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e628ef0e6859ffd8273c69412a2465c4be4a9517d07261b33334b5ec6f3c7489"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:841189848ba629c3552035a6a7f5bf3b02eb304e9fea7492ca220a8eda6b0e5c"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:ce1bbd7d780bb5a0da032e095c951f7014d6b0a205f8318308140f1a6aba159e"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:b26684587228afed0d50cf804cc71062cc9c1cdf55051c4c6345d372947b268c"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:9f9af11306994335398293f9958071019e3ab95e9a707dc1383a35613f6abcb9"},
- {file = "multidict-6.7.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:b4938326284c4f1224178a560987b6cf8b4d38458b113d9b8c1db1a836e640a2"},
- {file = "multidict-6.7.1-cp314-cp314t-win32.whl", hash = "sha256:98655c737850c064a65e006a3df7c997cd3b220be4ec8fe26215760b9697d4d7"},
- {file = "multidict-6.7.1-cp314-cp314t-win_amd64.whl", hash = "sha256:497bde6223c212ba11d462853cfa4f0ae6ef97465033e7dc9940cdb3ab5b48e5"},
- {file = "multidict-6.7.1-cp314-cp314t-win_arm64.whl", hash = "sha256:2bbd113e0d4af5db41d5ebfe9ccaff89de2120578164f86a5d17d5a576d1e5b2"},
- {file = "multidict-6.7.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:65573858d27cdeaca41893185677dc82395159aa28875a8867af66532d413a8f"},
- {file = "multidict-6.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c524c6fb8fc342793708ab111c4dbc90ff9abd568de220432500e47e990c0358"},
- {file = "multidict-6.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:aa23b001d968faef416ff70dc0f1ab045517b9b42a90edd3e9bcdb06479e31d5"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:6704fa2b7453b2fb121740555fa1ee20cd98c4d011120caf4d2b8d4e7c76eec0"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:121a34e5bfa410cdf2c8c49716de160de3b1dbcd86b49656f5681e4543bcd1a8"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:026d264228bcd637d4e060844e39cdc60f86c479e463d49075dedc21b18fbbe0"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:0e697826df7eb63418ee190fd06ce9f1803593bb4b9517d08c60d9b9a7f69d8f"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bb08271280173720e9fea9ede98e5231defcbad90f1624bea26f32ec8a956e2f"},
- {file = "multidict-6.7.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c6b3228e1d80af737b72925ce5fb4daf5a335e49cd7ab77ed7b9fdfbf58c526e"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:3943debf0fbb57bdde5901695c11094a9a36723e5c03875f87718ee15ca2f4d2"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:98c5787b0a0d9a41d9311eae44c3b76e6753def8d8870ab501320efe75a6a5f8"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:08ccb2a6dc72009093ebe7f3f073e5ec5964cba9a706fa94b1a1484039b87941"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:eb351f72c26dc9abe338ca7294661aa22969ad8ffe7ef7d5541d19f368dc854a"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ac1c665bad8b5d762f5f85ebe4d94130c26965f11de70c708c75671297c776de"},
- {file = "multidict-6.7.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:1fa6609d0364f4f6f58351b4659a1f3e0e898ba2a8c5cac04cb2c7bc556b0bc5"},
- {file = "multidict-6.7.1-cp39-cp39-win32.whl", hash = "sha256:6f77ce314a29263e67adadc7e7c1bc699fcb3a305059ab973d038f87caa42ed0"},
- {file = "multidict-6.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:f537b55778cd3cbee430abe3131255d3a78202e0f9ea7ffc6ada893a4bcaeea4"},
- {file = "multidict-6.7.1-cp39-cp39-win_arm64.whl", hash = "sha256:749aa54f578f2e5f439538706a475aa844bfa8ef75854b1401e6e528e4937cf9"},
- {file = "multidict-6.7.1-py3-none-any.whl", hash = "sha256:55d97cc6dae627efa6a6e548885712d4864b81110ac76fa4e534c03819fa4a56"},
- {file = "multidict-6.7.1.tar.gz", hash = "sha256:ec6652a1bee61c53a3e5776b6049172c53b6aaba34f18c9ad04f82712bac623d"},
-]
-
-[package.dependencies]
-typing-extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""}
-
[[package]]
name = "nodeenv"
version = "1.9.1"
@@ -1455,7 +969,7 @@ version = "25.0"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.8"
-groups = ["main", "dev"]
+groups = ["dev"]
files = [
{file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"},
{file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"},
@@ -1477,157 +991,6 @@ files = [
dev = ["pre-commit", "tox"]
testing = ["coverage", "pytest", "pytest-benchmark"]
-[[package]]
-name = "postgrest"
-version = "2.28.0"
-description = "PostgREST client for Python. This library provides an ORM interface to PostgREST."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "postgrest-2.28.0-py3-none-any.whl", hash = "sha256:7bca2f24dd1a1bf8a3d586c7482aba6cd41662da6733045fad585b63b7f7df75"},
- {file = "postgrest-2.28.0.tar.gz", hash = "sha256:c36b38646d25ea4255321d3d924ce70f8d20ec7799cb42c1221d6a818d4f6515"},
-]
-
-[package.dependencies]
-deprecation = ">=2.1.0"
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=1.9,<3.0"
-strenum = {version = ">=0.4.9", markers = "python_full_version < \"3.11.0\""}
-yarl = ">=1.20.1"
-
-[[package]]
-name = "propcache"
-version = "0.4.1"
-description = "Accelerated property cache"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "propcache-0.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7c2d1fa3201efaf55d730400d945b5b3ab6e672e100ba0f9a409d950ab25d7db"},
- {file = "propcache-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1eb2994229cc8ce7fe9b3db88f5465f5fd8651672840b2e426b88cdb1a30aac8"},
- {file = "propcache-0.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:66c1f011f45a3b33d7bcb22daed4b29c0c9e2224758b6be00686731e1b46f925"},
- {file = "propcache-0.4.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9a52009f2adffe195d0b605c25ec929d26b36ef986ba85244891dee3b294df21"},
- {file = "propcache-0.4.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5d4e2366a9c7b837555cf02fb9be2e3167d333aff716332ef1b7c3a142ec40c5"},
- {file = "propcache-0.4.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:9d2b6caef873b4f09e26ea7e33d65f42b944837563a47a94719cc3544319a0db"},
- {file = "propcache-0.4.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2b16ec437a8c8a965ecf95739448dd938b5c7f56e67ea009f4300d8df05f32b7"},
- {file = "propcache-0.4.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:296f4c8ed03ca7476813fe666c9ea97869a8d7aec972618671b33a38a5182ef4"},
- {file = "propcache-0.4.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:1f0978529a418ebd1f49dad413a2b68af33f85d5c5ca5c6ca2a3bed375a7ac60"},
- {file = "propcache-0.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:fd138803047fb4c062b1c1dd95462f5209456bfab55c734458f15d11da288f8f"},
- {file = "propcache-0.4.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:8c9b3cbe4584636d72ff556d9036e0c9317fa27b3ac1f0f558e7e84d1c9c5900"},
- {file = "propcache-0.4.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f93243fdc5657247533273ac4f86ae106cc6445a0efacb9a1bfe982fcfefd90c"},
- {file = "propcache-0.4.1-cp310-cp310-win32.whl", hash = "sha256:a0ee98db9c5f80785b266eb805016e36058ac72c51a064040f2bc43b61101cdb"},
- {file = "propcache-0.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:1cdb7988c4e5ac7f6d175a28a9aa0c94cb6f2ebe52756a3c0cda98d2809a9e37"},
- {file = "propcache-0.4.1-cp310-cp310-win_arm64.whl", hash = "sha256:d82ad62b19645419fe79dd63b3f9253e15b30e955c0170e5cebc350c1844e581"},
- {file = "propcache-0.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:60a8fda9644b7dfd5dece8c61d8a85e271cb958075bfc4e01083c148b61a7caf"},
- {file = "propcache-0.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c30b53e7e6bda1d547cabb47c825f3843a0a1a42b0496087bb58d8fedf9f41b5"},
- {file = "propcache-0.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6918ecbd897443087a3b7cd978d56546a812517dcaaca51b49526720571fa93e"},
- {file = "propcache-0.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3d902a36df4e5989763425a8ab9e98cd8ad5c52c823b34ee7ef307fd50582566"},
- {file = "propcache-0.4.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a9695397f85973bb40427dedddf70d8dc4a44b22f1650dd4af9eedf443d45165"},
- {file = "propcache-0.4.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2bb07ffd7eaad486576430c89f9b215f9e4be68c4866a96e97db9e97fead85dc"},
- {file = "propcache-0.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd6f30fdcf9ae2a70abd34da54f18da086160e4d7d9251f81f3da0ff84fc5a48"},
- {file = "propcache-0.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:fc38cba02d1acba4e2869eef1a57a43dfbd3d49a59bf90dda7444ec2be6a5570"},
- {file = "propcache-0.4.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:67fad6162281e80e882fb3ec355398cf72864a54069d060321f6cd0ade95fe85"},
- {file = "propcache-0.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f10207adf04d08bec185bae14d9606a1444715bc99180f9331c9c02093e1959e"},
- {file = "propcache-0.4.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:e9b0d8d0845bbc4cfcdcbcdbf5086886bc8157aa963c31c777ceff7846c77757"},
- {file = "propcache-0.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:981333cb2f4c1896a12f4ab92a9cc8f09ea664e9b7dbdc4eff74627af3a11c0f"},
- {file = "propcache-0.4.1-cp311-cp311-win32.whl", hash = "sha256:f1d2f90aeec838a52f1c1a32fe9a619fefd5e411721a9117fbf82aea638fe8a1"},
- {file = "propcache-0.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:364426a62660f3f699949ac8c621aad6977be7126c5807ce48c0aeb8e7333ea6"},
- {file = "propcache-0.4.1-cp311-cp311-win_arm64.whl", hash = "sha256:e53f3a38d3510c11953f3e6a33f205c6d1b001129f972805ca9b42fc308bc239"},
- {file = "propcache-0.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e153e9cd40cc8945138822807139367f256f89c6810c2634a4f6902b52d3b4e2"},
- {file = "propcache-0.4.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:cd547953428f7abb73c5ad82cbb32109566204260d98e41e5dfdc682eb7f8403"},
- {file = "propcache-0.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f048da1b4f243fc44f205dfd320933a951b8d89e0afd4c7cacc762a8b9165207"},
- {file = "propcache-0.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ec17c65562a827bba85e3872ead335f95405ea1674860d96483a02f5c698fa72"},
- {file = "propcache-0.4.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:405aac25c6394ef275dee4c709be43745d36674b223ba4eb7144bf4d691b7367"},
- {file = "propcache-0.4.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0013cb6f8dde4b2a2f66903b8ba740bdfe378c943c4377a200551ceb27f379e4"},
- {file = "propcache-0.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15932ab57837c3368b024473a525e25d316d8353016e7cc0e5ba9eb343fbb1cf"},
- {file = "propcache-0.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:031dce78b9dc099f4c29785d9cf5577a3faf9ebf74ecbd3c856a7b92768c3df3"},
- {file = "propcache-0.4.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:ab08df6c9a035bee56e31af99be621526bd237bea9f32def431c656b29e41778"},
- {file = "propcache-0.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:4d7af63f9f93fe593afbf104c21b3b15868efb2c21d07d8732c0c4287e66b6a6"},
- {file = "propcache-0.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:cfc27c945f422e8b5071b6e93169679e4eb5bf73bbcbf1ba3ae3a83d2f78ebd9"},
- {file = "propcache-0.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:35c3277624a080cc6ec6f847cbbbb5b49affa3598c4535a0a4682a697aaa5c75"},
- {file = "propcache-0.4.1-cp312-cp312-win32.whl", hash = "sha256:671538c2262dadb5ba6395e26c1731e1d52534bfe9ae56d0b5573ce539266aa8"},
- {file = "propcache-0.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:cb2d222e72399fcf5890d1d5cc1060857b9b236adff2792ff48ca2dfd46c81db"},
- {file = "propcache-0.4.1-cp312-cp312-win_arm64.whl", hash = "sha256:204483131fb222bdaaeeea9f9e6c6ed0cac32731f75dfc1d4a567fc1926477c1"},
- {file = "propcache-0.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:43eedf29202c08550aac1d14e0ee619b0430aaef78f85864c1a892294fbc28cf"},
- {file = "propcache-0.4.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:d62cdfcfd89ccb8de04e0eda998535c406bf5e060ffd56be6c586cbcc05b3311"},
- {file = "propcache-0.4.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cae65ad55793da34db5f54e4029b89d3b9b9490d8abe1b4c7ab5d4b8ec7ebf74"},
- {file = "propcache-0.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:333ddb9031d2704a301ee3e506dc46b1fe5f294ec198ed6435ad5b6a085facfe"},
- {file = "propcache-0.4.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fd0858c20f078a32cf55f7e81473d96dcf3b93fd2ccdb3d40fdf54b8573df3af"},
- {file = "propcache-0.4.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:678ae89ebc632c5c204c794f8dab2837c5f159aeb59e6ed0539500400577298c"},
- {file = "propcache-0.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d472aeb4fbf9865e0c6d622d7f4d54a4e101a89715d8904282bb5f9a2f476c3f"},
- {file = "propcache-0.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4d3df5fa7e36b3225954fba85589da77a0fe6a53e3976de39caf04a0db4c36f1"},
- {file = "propcache-0.4.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:ee17f18d2498f2673e432faaa71698032b0127ebf23ae5974eeaf806c279df24"},
- {file = "propcache-0.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:580e97762b950f993ae618e167e7be9256b8353c2dcd8b99ec100eb50f5286aa"},
- {file = "propcache-0.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:501d20b891688eb8e7aa903021f0b72d5a55db40ffaab27edefd1027caaafa61"},
- {file = "propcache-0.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9a0bd56e5b100aef69bd8562b74b46254e7c8812918d3baa700c8a8009b0af66"},
- {file = "propcache-0.4.1-cp313-cp313-win32.whl", hash = "sha256:bcc9aaa5d80322bc2fb24bb7accb4a30f81e90ab8d6ba187aec0744bc302ad81"},
- {file = "propcache-0.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:381914df18634f5494334d201e98245c0596067504b9372d8cf93f4bb23e025e"},
- {file = "propcache-0.4.1-cp313-cp313-win_arm64.whl", hash = "sha256:8873eb4460fd55333ea49b7d189749ecf6e55bf85080f11b1c4530ed3034cba1"},
- {file = "propcache-0.4.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:92d1935ee1f8d7442da9c0c4fa7ac20d07e94064184811b685f5c4fada64553b"},
- {file = "propcache-0.4.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:473c61b39e1460d386479b9b2f337da492042447c9b685f28be4f74d3529e566"},
- {file = "propcache-0.4.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:c0ef0aaafc66fbd87842a3fe3902fd889825646bc21149eafe47be6072725835"},
- {file = "propcache-0.4.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f95393b4d66bfae908c3ca8d169d5f79cd65636ae15b5e7a4f6e67af675adb0e"},
- {file = "propcache-0.4.1-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c07fda85708bc48578467e85099645167a955ba093be0a2dcba962195676e859"},
- {file = "propcache-0.4.1-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:af223b406d6d000830c6f65f1e6431783fc3f713ba3e6cc8c024d5ee96170a4b"},
- {file = "propcache-0.4.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a78372c932c90ee474559c5ddfffd718238e8673c340dc21fe45c5b8b54559a0"},
- {file = "propcache-0.4.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:564d9f0d4d9509e1a870c920a89b2fec951b44bf5ba7d537a9e7c1ccec2c18af"},
- {file = "propcache-0.4.1-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:17612831fda0138059cc5546f4d12a2aacfb9e47068c06af35c400ba58ba7393"},
- {file = "propcache-0.4.1-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:41a89040cb10bd345b3c1a873b2bf36413d48da1def52f268a055f7398514874"},
- {file = "propcache-0.4.1-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:e35b88984e7fa64aacecea39236cee32dd9bd8c55f57ba8a75cf2399553f9bd7"},
- {file = "propcache-0.4.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6f8b465489f927b0df505cbe26ffbeed4d6d8a2bbc61ce90eb074ff129ef0ab1"},
- {file = "propcache-0.4.1-cp313-cp313t-win32.whl", hash = "sha256:2ad890caa1d928c7c2965b48f3a3815c853180831d0e5503d35cf00c472f4717"},
- {file = "propcache-0.4.1-cp313-cp313t-win_amd64.whl", hash = "sha256:f7ee0e597f495cf415bcbd3da3caa3bd7e816b74d0d52b8145954c5e6fd3ff37"},
- {file = "propcache-0.4.1-cp313-cp313t-win_arm64.whl", hash = "sha256:929d7cbe1f01bb7baffb33dc14eb5691c95831450a26354cd210a8155170c93a"},
- {file = "propcache-0.4.1-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:3f7124c9d820ba5548d431afb4632301acf965db49e666aa21c305cbe8c6de12"},
- {file = "propcache-0.4.1-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c0d4b719b7da33599dfe3b22d3db1ef789210a0597bc650b7cee9c77c2be8c5c"},
- {file = "propcache-0.4.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:9f302f4783709a78240ebc311b793f123328716a60911d667e0c036bc5dcbded"},
- {file = "propcache-0.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c80ee5802e3fb9ea37938e7eecc307fb984837091d5fd262bb37238b1ae97641"},
- {file = "propcache-0.4.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ed5a841e8bb29a55fb8159ed526b26adc5bdd7e8bd7bf793ce647cb08656cdf4"},
- {file = "propcache-0.4.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:55c72fd6ea2da4c318e74ffdf93c4fe4e926051133657459131a95c846d16d44"},
- {file = "propcache-0.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8326e144341460402713f91df60ade3c999d601e7eb5ff8f6f7862d54de0610d"},
- {file = "propcache-0.4.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:060b16ae65bc098da7f6d25bf359f1f31f688384858204fe5d652979e0015e5b"},
- {file = "propcache-0.4.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:89eb3fa9524f7bec9de6e83cf3faed9d79bffa560672c118a96a171a6f55831e"},
- {file = "propcache-0.4.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:dee69d7015dc235f526fe80a9c90d65eb0039103fe565776250881731f06349f"},
- {file = "propcache-0.4.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:5558992a00dfd54ccbc64a32726a3357ec93825a418a401f5cc67df0ac5d9e49"},
- {file = "propcache-0.4.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:c9b822a577f560fbd9554812526831712c1436d2c046cedee4c3796d3543b144"},
- {file = "propcache-0.4.1-cp314-cp314-win32.whl", hash = "sha256:ab4c29b49d560fe48b696cdcb127dd36e0bc2472548f3bf56cc5cb3da2b2984f"},
- {file = "propcache-0.4.1-cp314-cp314-win_amd64.whl", hash = "sha256:5a103c3eb905fcea0ab98be99c3a9a5ab2de60228aa5aceedc614c0281cf6153"},
- {file = "propcache-0.4.1-cp314-cp314-win_arm64.whl", hash = "sha256:74c1fb26515153e482e00177a1ad654721bf9207da8a494a0c05e797ad27b992"},
- {file = "propcache-0.4.1-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:824e908bce90fb2743bd6b59db36eb4f45cd350a39637c9f73b1c1ea66f5b75f"},
- {file = "propcache-0.4.1-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:c2b5e7db5328427c57c8e8831abda175421b709672f6cfc3d630c3b7e2146393"},
- {file = "propcache-0.4.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:6f6ff873ed40292cd4969ef5310179afd5db59fdf055897e282485043fc80ad0"},
- {file = "propcache-0.4.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49a2dc67c154db2c1463013594c458881a069fcf98940e61a0569016a583020a"},
- {file = "propcache-0.4.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:005f08e6a0529984491e37d8dbc3dd86f84bd78a8ceb5fa9a021f4c48d4984be"},
- {file = "propcache-0.4.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5c3310452e0d31390da9035c348633b43d7e7feb2e37be252be6da45abd1abcc"},
- {file = "propcache-0.4.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c3c70630930447f9ef1caac7728c8ad1c56bc5015338b20fed0d08ea2480b3a"},
- {file = "propcache-0.4.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8e57061305815dfc910a3634dcf584f08168a8836e6999983569f51a8544cd89"},
- {file = "propcache-0.4.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:521a463429ef54143092c11a77e04056dd00636f72e8c45b70aaa3140d639726"},
- {file = "propcache-0.4.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:120c964da3fdc75e3731aa392527136d4ad35868cc556fd09bb6d09172d9a367"},
- {file = "propcache-0.4.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:d8f353eb14ee3441ee844ade4277d560cdd68288838673273b978e3d6d2c8f36"},
- {file = "propcache-0.4.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ab2943be7c652f09638800905ee1bab2c544e537edb57d527997a24c13dc1455"},
- {file = "propcache-0.4.1-cp314-cp314t-win32.whl", hash = "sha256:05674a162469f31358c30bcaa8883cb7829fa3110bf9c0991fe27d7896c42d85"},
- {file = "propcache-0.4.1-cp314-cp314t-win_amd64.whl", hash = "sha256:990f6b3e2a27d683cb7602ed6c86f15ee6b43b1194736f9baaeb93d0016633b1"},
- {file = "propcache-0.4.1-cp314-cp314t-win_arm64.whl", hash = "sha256:ecef2343af4cc68e05131e45024ba34f6095821988a9d0a02aa7c73fcc448aa9"},
- {file = "propcache-0.4.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3d233076ccf9e450c8b3bc6720af226b898ef5d051a2d145f7d765e6e9f9bcff"},
- {file = "propcache-0.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:357f5bb5c377a82e105e44bd3d52ba22b616f7b9773714bff93573988ef0a5fb"},
- {file = "propcache-0.4.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cbc3b6dfc728105b2a57c06791eb07a94229202ea75c59db644d7d496b698cac"},
- {file = "propcache-0.4.1-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:182b51b421f0501952d938dc0b0eb45246a5b5153c50d42b495ad5fb7517c888"},
- {file = "propcache-0.4.1-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4b536b39c5199b96fc6245eb5fb796c497381d3942f169e44e8e392b29c9ebcc"},
- {file = "propcache-0.4.1-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:db65d2af507bbfbdcedb254a11149f894169d90488dd3e7190f7cdcb2d6cd57a"},
- {file = "propcache-0.4.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd2dbc472da1f772a4dae4fa24be938a6c544671a912e30529984dd80400cd88"},
- {file = "propcache-0.4.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:daede9cd44e0f8bdd9e6cc9a607fc81feb80fae7a5fc6cecaff0e0bb32e42d00"},
- {file = "propcache-0.4.1-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:71b749281b816793678ae7f3d0d84bd36e694953822eaad408d682efc5ca18e0"},
- {file = "propcache-0.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:0002004213ee1f36cfb3f9a42b5066100c44276b9b72b4e1504cddd3d692e86e"},
- {file = "propcache-0.4.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:fe49d0a85038f36ba9e3ffafa1103e61170b28e95b16622e11be0a0ea07c6781"},
- {file = "propcache-0.4.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:99d43339c83aaf4d32bda60928231848eee470c6bda8d02599cc4cebe872d183"},
- {file = "propcache-0.4.1-cp39-cp39-win32.whl", hash = "sha256:a129e76735bc792794d5177069691c3217898b9f5cee2b2661471e52ffe13f19"},
- {file = "propcache-0.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:948dab269721ae9a87fd16c514a0a2c2a1bdb23a9a61b969b0f9d9ee2968546f"},
- {file = "propcache-0.4.1-cp39-cp39-win_arm64.whl", hash = "sha256:5fd37c406dd6dc85aa743e214cef35dc54bbdd1419baac4f6ae5e5b1a2976938"},
- {file = "propcache-0.4.1-py3-none-any.whl", hash = "sha256:af2a6052aeb6cf17d3e46ee169099044fd8224cbaf75c76a2ef596e8163e2237"},
- {file = "propcache-0.4.1.tar.gz", hash = "sha256:f48107a8c637e80362555f37ecf49abe20370e557cc4ab374f04ec4423c97c3d"},
-]
-
[[package]]
name = "proto-plus"
version = "1.26.1"
@@ -1891,7 +1254,7 @@ version = "2.19.2"
description = "Pygments is a syntax highlighting package written in Python."
optional = false
python-versions = ">=3.8"
-groups = ["main", "dev"]
+groups = ["dev"]
files = [
{file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"},
{file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"},
@@ -1900,77 +1263,6 @@ files = [
[package.extras]
windows-terminal = ["colorama (>=0.4.6)"]
-[[package]]
-name = "pyiceberg"
-version = "0.10.0"
-description = "Apache Iceberg is an open table format for huge analytic datasets"
-optional = false
-python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,!=3.8.*,>=3.9"
-groups = ["main"]
-files = [
- {file = "pyiceberg-0.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:03a4f208f0c59c040d2a6ff51b952479358810aac28c5271de3fd1fa425f063c"},
- {file = "pyiceberg-0.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6924f496f9a6e36f6530ce66483486f71d3cb4c08512d5aeb21095a9aa22d4b7"},
- {file = "pyiceberg-0.10.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e549ca852233b1aa20f2af1a8f9276b4a064c2515be0d73d36f28282502b8728"},
- {file = "pyiceberg-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:14a33da7eb579a02fc559d2e7b703a8133e81bc206bf11cb76ece9333ddfb7f3"},
- {file = "pyiceberg-0.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:4dfafd712fec5c3776fafbb444784e20256b8674cbe243487f8cd7f99a6e8836"},
- {file = "pyiceberg-0.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2c799c9149e06ef9ece22945d5c198ffc69f5c04b314b59a43c2d4c1bb9ade84"},
- {file = "pyiceberg-0.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a8c7070fe1262f50694b12241b5373ee89c8aededda82ef325cb14e5a95cc461"},
- {file = "pyiceberg-0.10.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e0d1a4896f546b1e115ece4212dd02b383eeb3c7ff5c072624b15f531b776f36"},
- {file = "pyiceberg-0.10.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1b0ef2f1880dd7549cc54ccb1a25f61ad5329e079cba372b4c239b0012aecac6"},
- {file = "pyiceberg-0.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:2127c795e451b971bd3f55cbda2d2c8200182bec3476e590e4a3453e60efda3c"},
- {file = "pyiceberg-0.10.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:64cad9d1db08192605875a872152cbcaca147ea486cfa94773fa5f4f65d78a23"},
- {file = "pyiceberg-0.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3e12cf585318f0f48d31a77b4149e0e5b4c41e03a24aa8612e060f20ff41eb10"},
- {file = "pyiceberg-0.10.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6979dd741cee263c1235595f71888c73365f2725697411027c4bd81046db3294"},
- {file = "pyiceberg-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:13fd03ec3da6eb4d3b55ff94b647946a7749bede5d743c75b39deaad26421200"},
- {file = "pyiceberg-0.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:33367c84bcb0a2fbbe54cbbfe062691ab93b91a2e3d319bb546ec5b9b45b6057"},
- {file = "pyiceberg-0.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:14cb3a5186e64f2ab37bc69cd7d1b32b25f416c87f9dadbcaa4f8e21b6c4e7b1"},
- {file = "pyiceberg-0.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9631d892f0977fbaef0498f088cb8535cd6b933606946dcce214a9a342d9c009"},
- {file = "pyiceberg-0.10.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:79016a97ec70a11e2920791fe2620b001bc5b657380d3d3ddf9f6a48af209615"},
- {file = "pyiceberg-0.10.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:912128d6b70313002b5418096c444afcde3d541e53b5e6a6b4df177531ac5686"},
- {file = "pyiceberg-0.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:0d76efec0409536bf48146961abc2b94e4001c647d348da8ea0f8ccca6504d1f"},
- {file = "pyiceberg-0.10.0.tar.gz", hash = "sha256:2525afa5e7e5fc4e72b291f8e1cc219e982d2bda5ff17e62cd05b8d91c4139f5"},
-]
-
-[package.dependencies]
-cachetools = ">=5.5,<7.0"
-click = ">=7.1.1,<9.0.0"
-fsspec = ">=2023.1.0"
-mmh3 = ">=4.0.0,<6.0.0"
-pydantic = ">=2.0,<2.4.0 || >2.4.0,<2.4.1 || >2.4.1,<3.0"
-pyparsing = ">=3.1.0,<4.0.0"
-pyroaring = ">=1.0.0,<2.0.0"
-requests = ">=2.20.0,<3.0.0"
-rich = ">=10.11.0,<15.0.0"
-sortedcontainers = "2.4.0"
-strictyaml = ">=1.7.0,<2.0.0"
-tenacity = ">=8.2.3,<10.0.0"
-
-[package.extras]
-adlfs = ["adlfs (>=2024.7.0)"]
-bigquery = ["google-cloud-bigquery (>=3.33.0,<4.0.0)"]
-bodo = ["bodo (>=2025.7.4)"]
-daft = ["daft (>=0.5.0)"]
-datafusion = ["datafusion (>=45)"]
-duckdb = ["duckdb (>=0.5.0,<2.0.0)", "pyarrow (>=17.0.0)"]
-dynamodb = ["boto3 (>=1.24.59)"]
-gcp-auth = ["google-auth (>=2.4.0)"]
-gcsfs = ["gcsfs (>=2023.1.0)"]
-glue = ["boto3 (>=1.24.59)"]
-hf = ["huggingface-hub (>=0.24.0)"]
-hive = ["thrift (>=0.13.0,<1.0.0)"]
-hive-kerberos = ["kerberos (>=1.3.1,<2.0.0)", "thrift (>=0.13.0,<1.0.0)", "thrift-sasl (>=0.4.3)"]
-pandas = ["pandas (>=1.0.0,<3.0.0)", "pyarrow (>=17.0.0)"]
-polars = ["polars (>=1.21.0,<2.0.0)"]
-pyarrow = ["pyarrow (>=17.0.0)", "pyiceberg-core (>=0.5.1,<0.7.0)"]
-pyiceberg-core = ["pyiceberg-core (>=0.5.1,<0.7.0)"]
-ray = ["pandas (>=1.0.0,<3.0.0)", "pyarrow (>=17.0.0)", "ray (==2.10.0) ; python_version < \"3.9\"", "ray (>=2.10.0,<=2.44.0) ; python_version >= \"3.9\""]
-rest-sigv4 = ["boto3 (>=1.24.59)"]
-s3fs = ["s3fs (>=2023.1.0)"]
-snappy = ["python-snappy (>=0.6.0,<1.0.0)"]
-sql-postgres = ["psycopg2-binary (>=2.9.6)", "sqlalchemy (>=2.0.18,<3.0.0)"]
-sql-sqlite = ["sqlalchemy (>=2.0.18,<3.0.0)"]
-zstandard = ["zstandard (>=0.13.0,<1.0.0)"]
-
[[package]]
name = "pyjwt"
version = "2.11.0"
@@ -1992,33 +1284,6 @@ dev = ["coverage[toml] (==7.10.7)", "cryptography (>=3.4.0)", "pre-commit", "pyt
docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"]
tests = ["coverage[toml] (==7.10.7)", "pytest (>=8.4.2,<9.0.0)"]
-[[package]]
-name = "pyparsing"
-version = "3.3.2"
-description = "pyparsing - Classes and methods to define and execute parsing grammars"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "pyparsing-3.3.2-py3-none-any.whl", hash = "sha256:850ba148bd908d7e2411587e247a1e4f0327839c40e2e5e6d05a007ecc69911d"},
- {file = "pyparsing-3.3.2.tar.gz", hash = "sha256:c777f4d763f140633dcb6d8a3eda953bf7a214dc4eff598413c070bcdc117cbc"},
-]
-
-[package.extras]
-diagrams = ["jinja2", "railroad-diagrams"]
-
-[[package]]
-name = "pyrfc3339"
-version = "2.0.1"
-description = "Generate and parse RFC 3339 timestamps"
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "pyRFC3339-2.0.1-py3-none-any.whl", hash = "sha256:30b70a366acac3df7386b558c21af871522560ed7f3f73cf344b8c2cbb8b0c9d"},
- {file = "pyrfc3339-2.0.1.tar.gz", hash = "sha256:e47843379ea35c1296c3b6c67a948a1a490ae0584edfcbdea0eaffb5dd29960b"},
-]
-
[[package]]
name = "pyright"
version = "1.1.408"
@@ -2040,100 +1305,6 @@ all = ["nodejs-wheel-binaries", "twine (>=3.4.1)"]
dev = ["twine (>=3.4.1)"]
nodejs = ["nodejs-wheel-binaries"]
-[[package]]
-name = "pyroaring"
-version = "1.0.3"
-description = "Library for handling efficiently sorted integer sets."
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "pyroaring-1.0.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c10e4cfbe203a578c78808406af491e3615d5e46cf69a7709050243346cd68bc"},
- {file = "pyroaring-1.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:cc329c62e504f2531c4008240f31736bcd2dee4339071f1eac0648068e6d17fa"},
- {file = "pyroaring-1.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8c7fb6ddf6ef31148f0939bc5c26b681d63df301ee1e372525012dd7bfe4a30a"},
- {file = "pyroaring-1.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd18446832ea04a7d33bd6b78270b0be14eabcda5937af3428d6cb3d2bf98e54"},
- {file = "pyroaring-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f0cbc766df2a24e28f23d69b66bbec64e691799219fd82c2f2236f03fc88e2e"},
- {file = "pyroaring-1.0.3-cp310-cp310-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:96a51e96f8f473381615f0f852f7238ad0a47f28e4a35e9f082468c5cfe4e9c3"},
- {file = "pyroaring-1.0.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:654af38b1f1c9bdc27b4f6d331fc5d91599df96e72a6df1886f4d95eea60ab29"},
- {file = "pyroaring-1.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6721036afa31c07bdcbb4fcafa166660cf9c2eac695dcd495f8778549fa55899"},
- {file = "pyroaring-1.0.3-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:0caa10f20329d09233fac6550b2adce4d9f173f748a9a9a5ea3b7033827dfe2d"},
- {file = "pyroaring-1.0.3-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:f109be8af937e85c52cb920d3fd120db52b172f59460852d2e3d2e3d13a4f52a"},
- {file = "pyroaring-1.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ddc80bfcd313c7c524a2742d263e73cae088b6a611b77dcc46fa90c306f6dace"},
- {file = "pyroaring-1.0.3-cp310-cp310-win32.whl", hash = "sha256:5a183f5ec069757fe5b60e37f7c6fa8a53178eacf0d76601b739e2890edee036"},
- {file = "pyroaring-1.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:051bd9a66ce855a1143faa2b879ea6c6ca2905209e172ce9eedf79834897c730"},
- {file = "pyroaring-1.0.3-cp310-cp310-win_arm64.whl", hash = "sha256:3043ff5c85375310ca3cd3e01944e03026e0ec07885e52dfabcfcd9dc303867f"},
- {file = "pyroaring-1.0.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:755cdac1f9a1b7b5c621e570d4f6dbcf3b8e4a1e35a66f976104ecb35dce4ed2"},
- {file = "pyroaring-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ebab073db620f26f0ba11e13fa2f35e3b1298209fba47b6bc8cb6f0e2c9627f9"},
- {file = "pyroaring-1.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:684fb8dffe19bdb7f91897c65eac6eee23b1e46043c47eb24288f28a1170fe04"},
- {file = "pyroaring-1.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:678d31fc24e82945a1bfb14816c77823983382ffea76985d494782aa2f058427"},
- {file = "pyroaring-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d815f624e0285db3669f673d1725cb754b120ec70d0032d7c7166103a96c96d"},
- {file = "pyroaring-1.0.3-cp311-cp311-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:57fd5b80dacb8e888402b6b7508a734c6a527063e4e24e882ff2e0fd90721ada"},
- {file = "pyroaring-1.0.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ab26a7a45a0bb46c00394d1a60a9f2d57c220f84586e30d59b39784b0f94aee6"},
- {file = "pyroaring-1.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:9232f3f606315d59049c128154100fd05008d5c5c211e48b21848cd41ee64d26"},
- {file = "pyroaring-1.0.3-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:f34b44b3ec3df97b978799f2901fefb2a48d367496fd1cde3cc5fe8b3bc13510"},
- {file = "pyroaring-1.0.3-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:25a83ec6bac3106568bd3fdd316f0fee52aa0be8c72da565ad02b10ae7905924"},
- {file = "pyroaring-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:c17d4ec53b5b6b333d9a9515051213a691293ada785dc8c025d3641482597ed3"},
- {file = "pyroaring-1.0.3-cp311-cp311-win32.whl", hash = "sha256:d54024459ace600f1d1ffbc6dc3c60eb47cca3b678701f06148f59e10f6f8d7b"},
- {file = "pyroaring-1.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:c28750148ef579a7447a8cb60b39e5943e03f8c29bce8f2788728f6f23d1887a"},
- {file = "pyroaring-1.0.3-cp311-cp311-win_arm64.whl", hash = "sha256:535d8deccbd8db2c6bf38629243e9646756905574a742b2a72ff51d6461d616c"},
- {file = "pyroaring-1.0.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:add3e4c78eb590a76526ecce8d1566eecdd5822e351c36b3697997f4a80ed808"},
- {file = "pyroaring-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ebaffe846cf4ba4f00ce6b8a9f39613f24e2d09447e77be4fa6e898bc36451b6"},
- {file = "pyroaring-1.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a9459f27498f97d08031a34a5ead230b77eb0ab3cc3d85b7f54faa2fd548acd6"},
- {file = "pyroaring-1.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2b2eb8bd1c35c772994889be9f7dda09477475d7aa1e2af9ab4ef18619326f6"},
- {file = "pyroaring-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d31f4c1c906f1af14ce61a3959d04a14a64c594f8a768399146a45bbd341f21f"},
- {file = "pyroaring-1.0.3-cp312-cp312-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:53be988fc86698d56c11049bfe5113a2f6990adb1fa2782b29636509808b6aa7"},
- {file = "pyroaring-1.0.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7df84d223424523b19a23781f4246cc247fd6d821e1bc0853c2f25669136f7d0"},
- {file = "pyroaring-1.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:34a781f1f9766897f63ef18be129827340ae37764015b83fdcff1efb9e29136d"},
- {file = "pyroaring-1.0.3-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:1f414343b4ed0756734328cdf2a91022fc54503769e3f8d79bd0b672ea815a16"},
- {file = "pyroaring-1.0.3-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d16ae185c72dc64f76335dbe53e53a892e78115adc92194957d1b7ef74d230b9"},
- {file = "pyroaring-1.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:f888447bf22dde7759108bfe6dfbeb6bbb61b14948de9c4cb6843c4dd57e2215"},
- {file = "pyroaring-1.0.3-cp312-cp312-win32.whl", hash = "sha256:fbbdc44c51a0a3efd7be3dbe04466278ce098fcd101aa1905849319042159770"},
- {file = "pyroaring-1.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:3b217c4b3ad953b4c759a0d2f9bd95316f0c345b9f7adb49e6ded7a1f5106bd4"},
- {file = "pyroaring-1.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:e6bcf838564c21bab8fe6c2748b4990d4cd90612d8c470c04889def7bb5114ea"},
- {file = "pyroaring-1.0.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:20bc947054b197d1baa76cd05d70b8e04f95b82e698266e2f8f2f4b36d764477"},
- {file = "pyroaring-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ba5909b4c66bb85cab345e2f3a87e5ce671509c94b8c9823d8db64e107cbe854"},
- {file = "pyroaring-1.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b744746ba5da27fad760067f12633f5d384db6a1e65648d00244ceacbbd87731"},
- {file = "pyroaring-1.0.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5b16c2a2791a5a09c4b59c0e1069ac1c877d0df25cae3155579c7eac8844676e"},
- {file = "pyroaring-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e7f68dfcf8d01177267f4bc06c4960fe8e39577470d1b52c9af8b61a72ca8767"},
- {file = "pyroaring-1.0.3-cp313-cp313-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:dba4e4700030182a981a3c887aa73887697145fc9ffb192f908aa59b718fbbdd"},
- {file = "pyroaring-1.0.3-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e26dd1dc1edba02288902914bdb559e53e346e9155defa43c31fcab831b55342"},
- {file = "pyroaring-1.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6eb98d2cacfc6d51c6a69893f04075e07b3df761eac71ba162c43b9b4c4452ad"},
- {file = "pyroaring-1.0.3-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:a967e9eddb9485cbdd95d6371e3dada67880844d836c0283d3b11efe9225d1b7"},
- {file = "pyroaring-1.0.3-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b12ef7f992ba7be865f91c7c098fd8ac6c413563aaa14d5b1e2bcb8cb43a4614"},
- {file = "pyroaring-1.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:82ca5be174b85c40be7b00bc6bf39b2931a1b4a465f3af17ec6b9c48e9aa6fe0"},
- {file = "pyroaring-1.0.3-cp313-cp313-win32.whl", hash = "sha256:f758c681e63ffe74b20423695e71f0410920f41b075cee679ffb5bc2bf38440b"},
- {file = "pyroaring-1.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:428c3bb384fe4c483feb5cf7aa3aef1621fb0a5c4f3d391da67b2c4a43f08a10"},
- {file = "pyroaring-1.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:9c0c856e8aa5606e8aed5f30201286e404fdc9093f81fefe82d2e79e67472bb2"},
- {file = "pyroaring-1.0.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6321a95b5b2ba69aa32e920dd1aa7f8fc4fac55b75981978aa4f2378724dee27"},
- {file = "pyroaring-1.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:054eb6ef04ff9d2ed3ddd18ae21e5e51e02d0f8cdd7e5cb948648f77ddb04ea2"},
- {file = "pyroaring-1.0.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4d064aea3827e63eb60294ae3e6623e29613f5c8844869646d06f3735a425dd9"},
- {file = "pyroaring-1.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c84d5b17ef628c3956d9a79c2f78c5bea7dda6f7aeb01f34671034d2650b9efb"},
- {file = "pyroaring-1.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8038f7dd25eb83c277b8e0ea14c5e61f085cc76bd0c6b9f6679f1770e33541ec"},
- {file = "pyroaring-1.0.3-cp38-cp38-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:defc508ef7acaf58d07e603c55feda6742c4034f5262cfd616f92cc3adbc2815"},
- {file = "pyroaring-1.0.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dd0831326971b0ffa08ccce79abe7c2450d5d9254804d855e23a8ba31f70351a"},
- {file = "pyroaring-1.0.3-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:03e063329481396cbb70f1ce8b8ca0f01d74a45ee9d908b6645b0282b23832b0"},
- {file = "pyroaring-1.0.3-cp38-cp38-musllinux_1_2_armv7l.whl", hash = "sha256:7a1b1c82d2da0bedc7c22d4047bd62544ef0e25c6be86ccf4b9d1ccc38876ee8"},
- {file = "pyroaring-1.0.3-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:dd7f9e5b7366b8f9bafca2a0fcf83fa534a00cc12d4ca01e301d8662bcdb805c"},
- {file = "pyroaring-1.0.3-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:a5a1db84e0952805223a7bf77eae58384b700a6b9affc53fb9772dddf868c712"},
- {file = "pyroaring-1.0.3-cp38-cp38-win32.whl", hash = "sha256:54cb0c2bddd330e22099773c4681aca90847265afe56a9201a92c1a758494261"},
- {file = "pyroaring-1.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:47d985293f861df1f2b03b41cef4fd3249c1c9608081750bcf3153051c2312d0"},
- {file = "pyroaring-1.0.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:d46eb5db78b673d8d8ca83651a1cce1e15eec5a922f2951b1f61014463b72af5"},
- {file = "pyroaring-1.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ce202452de2b58bffa3eb02e27c681eefcfb54e27f8ef85b5c93ebaada50f3f3"},
- {file = "pyroaring-1.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:531b6ae56989b61742dde1b64fedc5537acc046cf04a333548322366c1bf3922"},
- {file = "pyroaring-1.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3035db9459bd8635a0145b4a9e3102869d621cb0b3648051115f06d31ffd1976"},
- {file = "pyroaring-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7c8fb6b0ad0e8db1b9559b2da180b103b48adddf0e4f24404269e2a3b5db268d"},
- {file = "pyroaring-1.0.3-cp39-cp39-manylinux_2_24_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:8d5df95d9511bc83048da9348c7ab1c20f97ff4d95faf27ee1fdf2e8a96e200e"},
- {file = "pyroaring-1.0.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:65d2d81e5aed7698fab23058db70fb2b65fad221090be037a0af498569109915"},
- {file = "pyroaring-1.0.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:e195636034a0b62ec0e5325ed2f610f39cc8955ace3f47a5bc7f484159f02341"},
- {file = "pyroaring-1.0.3-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:bb7f2561e3ec26c3c869458431cbcba6b83f7e925b024460c136dbb5fadf3b31"},
- {file = "pyroaring-1.0.3-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:8e996939de01f448eb9448d91b47ab60bff0555c2a80d5c12a8405814072cd35"},
- {file = "pyroaring-1.0.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:c656d62d0cf96ede0edc4e7d392889238777bdf88b32afd5d51c3cab016c29a0"},
- {file = "pyroaring-1.0.3-cp39-cp39-win32.whl", hash = "sha256:a7a7d14822c64841ae64e98309697e1631ebadba55ded33daa7cd16d1b487d11"},
- {file = "pyroaring-1.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:a86b88adbe0531b75f94f87279a6d4ee68e63335e29bbdab4400a05704fc2587"},
- {file = "pyroaring-1.0.3-cp39-cp39-win_arm64.whl", hash = "sha256:1ed2e9c7af46052466b5fa0392fe540331474718d97b9756cefa23233bfdb3ea"},
- {file = "pyroaring-1.0.3.tar.gz", hash = "sha256:cd7392d1c010c9e41c11c62cd0610c8852e7e9698b1f7f6c2fcdefe50e7ef6da"},
-]
-
[[package]]
name = "pytest"
version = "8.4.1"
@@ -2217,21 +1388,6 @@ pytest = ">=6.2.5"
[package.extras]
dev = ["pre-commit", "pytest-asyncio", "tox"]
-[[package]]
-name = "python-dateutil"
-version = "2.9.0.post0"
-description = "Extensions to the standard Python datetime module"
-optional = false
-python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
-groups = ["main"]
-files = [
- {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"},
- {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},
-]
-
-[package.dependencies]
-six = ">=1.5"
-
[[package]]
name = "python-dotenv"
version = "1.1.1"
@@ -2247,23 +1403,6 @@ files = [
[package.extras]
cli = ["click (>=5.0)"]
-[[package]]
-name = "realtime"
-version = "2.28.0"
-description = ""
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "realtime-2.28.0-py3-none-any.whl", hash = "sha256:db1bd59bab9b1fcc9f9d3b1a073bed35bf4994d720e6751f10031a58d57a3836"},
- {file = "realtime-2.28.0.tar.gz", hash = "sha256:d18cedcebd6a8f22fcd509bc767f639761eb218b7b2b6f14fc4205b6259b50fc"},
-]
-
-[package.dependencies]
-pydantic = ">=2.11.7,<3.0.0"
-typing-extensions = ">=4.14.0"
-websockets = ">=11,<16"
-
[[package]]
name = "redis"
version = "6.2.0"
@@ -2306,25 +1445,6 @@ urllib3 = ">=1.21.1,<3"
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
-[[package]]
-name = "rich"
-version = "14.3.2"
-description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
-optional = false
-python-versions = ">=3.8.0"
-groups = ["main"]
-files = [
- {file = "rich-14.3.2-py3-none-any.whl", hash = "sha256:08e67c3e90884651da3239ea668222d19bea7b589149d8014a21c633420dbb69"},
- {file = "rich-14.3.2.tar.gz", hash = "sha256:e712f11c1a562a11843306f5ed999475f09ac31ffb64281f73ab29ffdda8b3b8"},
-]
-
-[package.dependencies]
-markdown-it-py = ">=2.2.0"
-pygments = ">=2.13.0,<3.0.0"
-
-[package.extras]
-jupyter = ["ipywidgets (>=7.5.1,<9)"]
-
[[package]]
name = "rsa"
version = "4.9.1"
@@ -2368,54 +1488,18 @@ files = [
{file = "ruff-0.15.7.tar.gz", hash = "sha256:04f1ae61fc20fe0b148617c324d9d009b5f63412c0b16474f3d5f1a1a665f7ac"},
]
-[[package]]
-name = "semver"
-version = "3.0.4"
-description = "Python helper for Semantic Versioning (https://semver.org)"
-optional = false
-python-versions = ">=3.7"
-groups = ["main"]
-files = [
- {file = "semver-3.0.4-py3-none-any.whl", hash = "sha256:9c824d87ba7f7ab4a1890799cec8596f15c1241cb473404ea1cb0c55e4b04746"},
- {file = "semver-3.0.4.tar.gz", hash = "sha256:afc7d8c584a5ed0a11033af086e8af226a9c0b206f313e0301f8dd7b6b589602"},
-]
-
-[[package]]
-name = "six"
-version = "1.17.0"
-description = "Python 2 and 3 compatibility utilities"
-optional = false
-python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
-groups = ["main"]
-files = [
- {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"},
- {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"},
-]
-
[[package]]
name = "sniffio"
version = "1.3.1"
description = "Sniff out which async library your code is running under"
optional = false
python-versions = ">=3.7"
-groups = ["main"]
+groups = ["main", "dev"]
files = [
{file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"},
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
]
-[[package]]
-name = "sortedcontainers"
-version = "2.4.0"
-description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set"
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"},
- {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"},
-]
-
[[package]]
name = "starlette"
version = "0.47.1"
@@ -2435,128 +1519,6 @@ typing-extensions = {version = ">=4.10.0", markers = "python_version < \"3.13\""
[package.extras]
full = ["httpx (>=0.27.0,<0.29.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.18)", "pyyaml"]
-[[package]]
-name = "storage3"
-version = "2.28.0"
-description = "Supabase Storage client for Python."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "storage3-2.28.0-py3-none-any.whl", hash = "sha256:ecb50efd2ac71dabbdf97e99ad346eafa630c4c627a8e5a138ceb5fbbadae716"},
- {file = "storage3-2.28.0.tar.gz", hash = "sha256:bc1d008aff67de7a0f2bd867baee7aadbcdb6f78f5a310b4f7a38e8c13c19865"},
-]
-
-[package.dependencies]
-deprecation = ">=2.1.0"
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=2.11.7"
-pyiceberg = ">=0.10.0"
-yarl = ">=1.20.1"
-
-[[package]]
-name = "strenum"
-version = "0.4.15"
-description = "An Enum that inherits from str."
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "StrEnum-0.4.15-py3-none-any.whl", hash = "sha256:a30cda4af7cc6b5bf52c8055bc4bf4b2b6b14a93b574626da33df53cf7740659"},
- {file = "StrEnum-0.4.15.tar.gz", hash = "sha256:878fb5ab705442070e4dd1929bb5e2249511c0bcf2b0eeacf3bcd80875c82eff"},
-]
-
-[package.extras]
-docs = ["myst-parser[linkify]", "sphinx", "sphinx-rtd-theme"]
-release = ["twine"]
-test = ["pylint", "pytest", "pytest-black", "pytest-cov", "pytest-pylint"]
-
-[[package]]
-name = "strictyaml"
-version = "1.7.3"
-description = "Strict, typed YAML parser"
-optional = false
-python-versions = ">=3.7.0"
-groups = ["main"]
-files = [
- {file = "strictyaml-1.7.3-py3-none-any.whl", hash = "sha256:fb5c8a4edb43bebb765959e420f9b3978d7f1af88c80606c03fb420888f5d1c7"},
- {file = "strictyaml-1.7.3.tar.gz", hash = "sha256:22f854a5fcab42b5ddba8030a0e4be51ca89af0267961c8d6cfa86395586c407"},
-]
-
-[package.dependencies]
-python-dateutil = ">=2.6.0"
-
-[[package]]
-name = "supabase"
-version = "2.28.0"
-description = "Supabase client for Python."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase-2.28.0-py3-none-any.whl", hash = "sha256:42776971c7d0ccca16034df1ab96a31c50228eb1eb19da4249ad2f756fc20272"},
- {file = "supabase-2.28.0.tar.gz", hash = "sha256:aea299aaab2a2eed3c57e0be7fc035c6807214194cce795a3575add20268ece1"},
-]
-
-[package.dependencies]
-httpx = ">=0.26,<0.29"
-postgrest = "2.28.0"
-realtime = "2.28.0"
-storage3 = "2.28.0"
-supabase-auth = "2.28.0"
-supabase-functions = "2.28.0"
-yarl = ">=1.22.0"
-
-[[package]]
-name = "supabase-auth"
-version = "2.28.0"
-description = "Python Client Library for Supabase Auth"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase_auth-2.28.0-py3-none-any.whl", hash = "sha256:2ac85026cc285054c7fa6d41924f3a333e9ec298c013e5b5e1754039ba7caec9"},
- {file = "supabase_auth-2.28.0.tar.gz", hash = "sha256:2bb8f18ff39934e44b28f10918db965659f3735cd6fbfcc022fe0b82dbf8233e"},
-]
-
-[package.dependencies]
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=1.10,<3"
-pyjwt = {version = ">=2.10.1", extras = ["crypto"]}
-
-[[package]]
-name = "supabase-functions"
-version = "2.28.0"
-description = "Library for Supabase Functions"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase_functions-2.28.0-py3-none-any.whl", hash = "sha256:30bf2d586f8df285faf0621bb5d5bb3ec3157234fc820553ca156f009475e4ae"},
- {file = "supabase_functions-2.28.0.tar.gz", hash = "sha256:db3dddfc37aca5858819eb461130968473bd8c75bd284581013958526dac718b"},
-]
-
-[package.dependencies]
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-strenum = ">=0.4.15"
-yarl = ">=1.20.1"
-
-[[package]]
-name = "tenacity"
-version = "9.1.2"
-description = "Retry code until it succeeds"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "tenacity-9.1.2-py3-none-any.whl", hash = "sha256:f77bf36710d8b73a50b2dd155c97b870017ad21afe6ab300326b0371b3b05138"},
- {file = "tenacity-9.1.2.tar.gz", hash = "sha256:1169d376c297e7de388d18b4481760d478b0e99a777cad3a9c86e556f4b697cb"},
-]
-
-[package.extras]
-doc = ["reno", "sphinx"]
-test = ["pytest", "tornado (>=4.5)", "typeguard"]
-
[[package]]
name = "tomli"
version = "2.2.1"
@@ -2564,7 +1526,7 @@ description = "A lil' TOML parser"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
-markers = "python_version == \"3.10\""
+markers = "python_version < \"3.11\""
files = [
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
@@ -2645,250 +1607,6 @@ h2 = ["h2 (>=4,<5)"]
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
zstd = ["zstandard (>=0.18.0)"]
-[[package]]
-name = "uvicorn"
-version = "0.40.0"
-description = "The lightning-fast ASGI server."
-optional = false
-python-versions = ">=3.10"
-groups = ["main"]
-files = [
- {file = "uvicorn-0.40.0-py3-none-any.whl", hash = "sha256:c6c8f55bc8bf13eb6fa9ff87ad62308bbbc33d0b67f84293151efe87e0d5f2ee"},
- {file = "uvicorn-0.40.0.tar.gz", hash = "sha256:839676675e87e73694518b5574fd0f24c9d97b46bea16df7b8c05ea1a51071ea"},
-]
-
-[package.dependencies]
-click = ">=7.0"
-h11 = ">=0.8"
-typing-extensions = {version = ">=4.0", markers = "python_version < \"3.11\""}
-
-[package.extras]
-standard = ["colorama (>=0.4) ; sys_platform == \"win32\"", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.15.1) ; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"", "watchfiles (>=0.13)", "websockets (>=10.4)"]
-
-[[package]]
-name = "websockets"
-version = "15.0.1"
-description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "websockets-15.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d63efaa0cd96cf0c5fe4d581521d9fa87744540d4bc999ae6e08595a1014b45b"},
- {file = "websockets-15.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ac60e3b188ec7574cb761b08d50fcedf9d77f1530352db4eef1707fe9dee7205"},
- {file = "websockets-15.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5756779642579d902eed757b21b0164cd6fe338506a8083eb58af5c372e39d9a"},
- {file = "websockets-15.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fdfe3e2a29e4db3659dbd5bbf04560cea53dd9610273917799f1cde46aa725e"},
- {file = "websockets-15.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c2529b320eb9e35af0fa3016c187dffb84a3ecc572bcee7c3ce302bfeba52bf"},
- {file = "websockets-15.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac1e5c9054fe23226fb11e05a6e630837f074174c4c2f0fe442996112a6de4fb"},
- {file = "websockets-15.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5df592cd503496351d6dc14f7cdad49f268d8e618f80dce0cd5a36b93c3fc08d"},
- {file = "websockets-15.0.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0a34631031a8f05657e8e90903e656959234f3a04552259458aac0b0f9ae6fd9"},
- {file = "websockets-15.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d00075aa65772e7ce9e990cab3ff1de702aa09be3940d1dc88d5abf1ab8a09c"},
- {file = "websockets-15.0.1-cp310-cp310-win32.whl", hash = "sha256:1234d4ef35db82f5446dca8e35a7da7964d02c127b095e172e54397fb6a6c256"},
- {file = "websockets-15.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:39c1fec2c11dc8d89bba6b2bf1556af381611a173ac2b511cf7231622058af41"},
- {file = "websockets-15.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:823c248b690b2fd9303ba00c4f66cd5e2d8c3ba4aa968b2779be9532a4dad431"},
- {file = "websockets-15.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678999709e68425ae2593acf2e3ebcbcf2e69885a5ee78f9eb80e6e371f1bf57"},
- {file = "websockets-15.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d50fd1ee42388dcfb2b3676132c78116490976f1300da28eb629272d5d93e905"},
- {file = "websockets-15.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d99e5546bf73dbad5bf3547174cd6cb8ba7273062a23808ffea025ecb1cf8562"},
- {file = "websockets-15.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:66dd88c918e3287efc22409d426c8f729688d89a0c587c88971a0faa2c2f3792"},
- {file = "websockets-15.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8dd8327c795b3e3f219760fa603dcae1dcc148172290a8ab15158cf85a953413"},
- {file = "websockets-15.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fdc51055e6ff4adeb88d58a11042ec9a5eae317a0a53d12c062c8a8865909e8"},
- {file = "websockets-15.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:693f0192126df6c2327cce3baa7c06f2a117575e32ab2308f7f8216c29d9e2e3"},
- {file = "websockets-15.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54479983bd5fb469c38f2f5c7e3a24f9a4e70594cd68cd1fa6b9340dadaff7cf"},
- {file = "websockets-15.0.1-cp311-cp311-win32.whl", hash = "sha256:16b6c1b3e57799b9d38427dda63edcbe4926352c47cf88588c0be4ace18dac85"},
- {file = "websockets-15.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:27ccee0071a0e75d22cb35849b1db43f2ecd3e161041ac1ee9d2352ddf72f065"},
- {file = "websockets-15.0.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3e90baa811a5d73f3ca0bcbf32064d663ed81318ab225ee4f427ad4e26e5aff3"},
- {file = "websockets-15.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:592f1a9fe869c778694f0aa806ba0374e97648ab57936f092fd9d87f8bc03665"},
- {file = "websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2"},
- {file = "websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8b56bdcdb4505c8078cb6c7157d9811a85790f2f2b3632c7d1462ab5783d215"},
- {file = "websockets-15.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0af68c55afbd5f07986df82831c7bff04846928ea8d1fd7f30052638788bc9b5"},
- {file = "websockets-15.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dee438fed052b52e4f98f76c5790513235efaa1ef7f3f2192c392cd7c91b65"},
- {file = "websockets-15.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d5f6b181bb38171a8ad1d6aa58a67a6aa9d4b38d0f8c5f496b9e42561dfc62fe"},
- {file = "websockets-15.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5d54b09eba2bada6011aea5375542a157637b91029687eb4fdb2dab11059c1b4"},
- {file = "websockets-15.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be571a8b5afed347da347bfcf27ba12b069d9d7f42cb8c7028b5e98bbb12597"},
- {file = "websockets-15.0.1-cp312-cp312-win32.whl", hash = "sha256:c338ffa0520bdb12fbc527265235639fb76e7bc7faafbb93f6ba80d9c06578a9"},
- {file = "websockets-15.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcd5cf9e305d7b8338754470cf69cf81f420459dbae8a3b40cee57417f4614a7"},
- {file = "websockets-15.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ee443ef070bb3b6ed74514f5efaa37a252af57c90eb33b956d35c8e9c10a1931"},
- {file = "websockets-15.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a939de6b7b4e18ca683218320fc67ea886038265fd1ed30173f5ce3f8e85675"},
- {file = "websockets-15.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:746ee8dba912cd6fc889a8147168991d50ed70447bf18bcda7039f7d2e3d9151"},
- {file = "websockets-15.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:595b6c3969023ecf9041b2936ac3827e4623bfa3ccf007575f04c5a6aa318c22"},
- {file = "websockets-15.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c714d2fc58b5ca3e285461a4cc0c9a66bd0e24c5da9911e30158286c9b5be7f"},
- {file = "websockets-15.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3c1e2ab208db911594ae5b4f79addeb3501604a165019dd221c0bdcabe4db8"},
- {file = "websockets-15.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:229cf1d3ca6c1804400b0a9790dc66528e08a6a1feec0d5040e8b9eb14422375"},
- {file = "websockets-15.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:756c56e867a90fb00177d530dca4b097dd753cde348448a1012ed6c5131f8b7d"},
- {file = "websockets-15.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:558d023b3df0bffe50a04e710bc87742de35060580a293c2a984299ed83bc4e4"},
- {file = "websockets-15.0.1-cp313-cp313-win32.whl", hash = "sha256:ba9e56e8ceeeedb2e080147ba85ffcd5cd0711b89576b83784d8605a7df455fa"},
- {file = "websockets-15.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:e09473f095a819042ecb2ab9465aee615bd9c2028e4ef7d933600a8401c79561"},
- {file = "websockets-15.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5f4c04ead5aed67c8a1a20491d54cdfba5884507a48dd798ecaf13c74c4489f5"},
- {file = "websockets-15.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abdc0c6c8c648b4805c5eacd131910d2a7f6455dfd3becab248ef108e89ab16a"},
- {file = "websockets-15.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a625e06551975f4b7ea7102bc43895b90742746797e2e14b70ed61c43a90f09b"},
- {file = "websockets-15.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d591f8de75824cbb7acad4e05d2d710484f15f29d4a915092675ad3456f11770"},
- {file = "websockets-15.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:47819cea040f31d670cc8d324bb6435c6f133b8c7a19ec3d61634e62f8d8f9eb"},
- {file = "websockets-15.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac017dd64572e5c3bd01939121e4d16cf30e5d7e110a119399cf3133b63ad054"},
- {file = "websockets-15.0.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:4a9fac8e469d04ce6c25bb2610dc535235bd4aa14996b4e6dbebf5e007eba5ee"},
- {file = "websockets-15.0.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363c6f671b761efcb30608d24925a382497c12c506b51661883c3e22337265ed"},
- {file = "websockets-15.0.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:2034693ad3097d5355bfdacfffcbd3ef5694f9718ab7f29c29689a9eae841880"},
- {file = "websockets-15.0.1-cp39-cp39-win32.whl", hash = "sha256:3b1ac0d3e594bf121308112697cf4b32be538fb1444468fb0a6ae4feebc83411"},
- {file = "websockets-15.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7643a03db5c95c799b89b31c036d5f27eeb4d259c798e878d6937d71832b1e4"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0c9e74d766f2818bb95f84c25be4dea09841ac0f734d1966f415e4edfc4ef1c3"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1009ee0c7739c08a0cd59de430d6de452a55e42d6b522de7aa15e6f67db0b8e1"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76d1f20b1c7a2fa82367e04982e708723ba0e7b8d43aa643d3dcd404d74f1475"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f29d80eb9a9263b8d109135351caf568cc3f80b9928bccde535c235de55c22d9"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b359ed09954d7c18bbc1680f380c7301f92c60bf924171629c5db97febb12f04"},
- {file = "websockets-15.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:cad21560da69f4ce7658ca2cb83138fb4cf695a2ba3e475e0559e05991aa8122"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7f493881579c90fc262d9cdbaa05a6b54b3811c2f300766748db79f098db9940"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:47b099e1f4fbc95b701b6e85768e1fcdaf1630f3cbe4765fa216596f12310e2e"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67f2b6de947f8c757db2db9c71527933ad0019737ec374a8a6be9a956786aaf9"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d08eb4c2b7d6c41da6ca0600c077e93f5adcfd979cd777d747e9ee624556da4b"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b826973a4a2ae47ba357e4e82fa44a463b8f168e1ca775ac64521442b19e87f"},
- {file = "websockets-15.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:21c1fa28a6a7e3cbdc171c694398b6df4744613ce9b36b1a498e816787e28123"},
- {file = "websockets-15.0.1-py3-none-any.whl", hash = "sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f"},
- {file = "websockets-15.0.1.tar.gz", hash = "sha256:82544de02076bafba038ce055ee6412d68da13ab47f0c60cab827346de828dee"},
-]
-
-[[package]]
-name = "yarl"
-version = "1.22.0"
-description = "Yet another URL library"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "yarl-1.22.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c7bd6683587567e5a49ee6e336e0612bec8329be1b7d4c8af5687dcdeb67ee1e"},
- {file = "yarl-1.22.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5cdac20da754f3a723cceea5b3448e1a2074866406adeb4ef35b469d089adb8f"},
- {file = "yarl-1.22.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:07a524d84df0c10f41e3ee918846e1974aba4ec017f990dc735aad487a0bdfdf"},
- {file = "yarl-1.22.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e1b329cb8146d7b736677a2440e422eadd775d1806a81db2d4cded80a48efc1a"},
- {file = "yarl-1.22.0-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:75976c6945d85dbb9ee6308cd7ff7b1fb9409380c82d6119bd778d8fcfe2931c"},
- {file = "yarl-1.22.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:80ddf7a5f8c86cb3eb4bc9028b07bbbf1f08a96c5c0bc1244be5e8fefcb94147"},
- {file = "yarl-1.22.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d332fc2e3c94dad927f2112395772a4e4fedbcf8f80efc21ed7cdfae4d574fdb"},
- {file = "yarl-1.22.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0cf71bf877efeac18b38d3930594c0948c82b64547c1cf420ba48722fe5509f6"},
- {file = "yarl-1.22.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:663e1cadaddae26be034a6ab6072449a8426ddb03d500f43daf952b74553bba0"},
- {file = "yarl-1.22.0-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:6dcbb0829c671f305be48a7227918cfcd11276c2d637a8033a99a02b67bf9eda"},
- {file = "yarl-1.22.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:f0d97c18dfd9a9af4490631905a3f131a8e4c9e80a39353919e2cfed8f00aedc"},
- {file = "yarl-1.22.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:437840083abe022c978470b942ff832c3940b2ad3734d424b7eaffcd07f76737"},
- {file = "yarl-1.22.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:a899cbd98dce6f5d8de1aad31cb712ec0a530abc0a86bd6edaa47c1090138467"},
- {file = "yarl-1.22.0-cp310-cp310-win32.whl", hash = "sha256:595697f68bd1f0c1c159fcb97b661fc9c3f5db46498043555d04805430e79bea"},
- {file = "yarl-1.22.0-cp310-cp310-win_amd64.whl", hash = "sha256:cb95a9b1adaa48e41815a55ae740cfda005758104049a640a398120bf02515ca"},
- {file = "yarl-1.22.0-cp310-cp310-win_arm64.whl", hash = "sha256:b85b982afde6df99ecc996990d4ad7ccbdbb70e2a4ba4de0aecde5922ba98a0b"},
- {file = "yarl-1.22.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:1ab72135b1f2db3fed3997d7e7dc1b80573c67138023852b6efb336a5eae6511"},
- {file = "yarl-1.22.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:669930400e375570189492dc8d8341301578e8493aec04aebc20d4717f899dd6"},
- {file = "yarl-1.22.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:792a2af6d58177ef7c19cbf0097aba92ca1b9cb3ffdd9c7470e156c8f9b5e028"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3ea66b1c11c9150f1372f69afb6b8116f2dd7286f38e14ea71a44eee9ec51b9d"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3e2daa88dc91870215961e96a039ec73e4937da13cf77ce17f9cad0c18df3503"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ba440ae430c00eee41509353628600212112cd5018d5def7e9b05ea7ac34eb65"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e6438cc8f23a9c1478633d216b16104a586b9761db62bfacb6425bac0a36679e"},
- {file = "yarl-1.22.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c52a6e78aef5cf47a98ef8e934755abf53953379b7d53e68b15ff4420e6683d"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:3b06bcadaac49c70f4c88af4ffcfbe3dc155aab3163e75777818092478bcbbe7"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:6944b2dc72c4d7f7052683487e3677456050ff77fcf5e6204e98caf785ad1967"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:d5372ca1df0f91a86b047d1277c2aaf1edb32d78bbcefffc81b40ffd18f027ed"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:51af598701f5299012b8416486b40fceef8c26fc87dc6d7d1f6fc30609ea0aa6"},
- {file = "yarl-1.22.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b266bd01fedeffeeac01a79ae181719ff848a5a13ce10075adbefc8f1daee70e"},
- {file = "yarl-1.22.0-cp311-cp311-win32.whl", hash = "sha256:a9b1ba5610a4e20f655258d5a1fdc7ebe3d837bb0e45b581398b99eb98b1f5ca"},
- {file = "yarl-1.22.0-cp311-cp311-win_amd64.whl", hash = "sha256:078278b9b0b11568937d9509b589ee83ef98ed6d561dfe2020e24a9fd08eaa2b"},
- {file = "yarl-1.22.0-cp311-cp311-win_arm64.whl", hash = "sha256:b6a6f620cfe13ccec221fa312139135166e47ae169f8253f72a0abc0dae94376"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e340382d1afa5d32b892b3ff062436d592ec3d692aeea3bef3a5cfe11bbf8c6f"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f1e09112a2c31ffe8d80be1b0988fa6a18c5d5cad92a9ffbb1c04c91bfe52ad2"},
- {file = "yarl-1.22.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:939fe60db294c786f6b7c2d2e121576628468f65453d86b0fe36cb52f987bd74"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e1651bf8e0398574646744c1885a41198eba53dc8a9312b954073f845c90a8df"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b8a0588521a26bf92a57a1705b77b8b59044cdceccac7151bd8d229e66b8dedb"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:42188e6a615c1a75bcaa6e150c3fe8f3e8680471a6b10150c5f7e83f47cc34d2"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f6d2cb59377d99718913ad9a151030d6f83ef420a2b8f521d94609ecc106ee82"},
- {file = "yarl-1.22.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:50678a3b71c751d58d7908edc96d332af328839eea883bb554a43f539101277a"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1e8fbaa7cec507aa24ea27a01456e8dd4b6fab829059b69844bd348f2d467124"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:433885ab5431bc3d3d4f2f9bd15bfa1614c522b0f1405d62c4f926ccd69d04fa"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:b790b39c7e9a4192dc2e201a282109ed2985a1ddbd5ac08dc56d0e121400a8f7"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:31f0b53913220599446872d757257be5898019c85e7971599065bc55065dc99d"},
- {file = "yarl-1.22.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a49370e8f711daec68d09b821a34e1167792ee2d24d405cbc2387be4f158b520"},
- {file = "yarl-1.22.0-cp312-cp312-win32.whl", hash = "sha256:70dfd4f241c04bd9239d53b17f11e6ab672b9f1420364af63e8531198e3f5fe8"},
- {file = "yarl-1.22.0-cp312-cp312-win_amd64.whl", hash = "sha256:8884d8b332a5e9b88e23f60bb166890009429391864c685e17bd73a9eda9105c"},
- {file = "yarl-1.22.0-cp312-cp312-win_arm64.whl", hash = "sha256:ea70f61a47f3cc93bdf8b2f368ed359ef02a01ca6393916bc8ff877427181e74"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8dee9c25c74997f6a750cd317b8ca63545169c098faee42c84aa5e506c819b53"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:01e73b85a5434f89fc4fe27dcda2aff08ddf35e4d47bbbea3bdcd25321af538a"},
- {file = "yarl-1.22.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:22965c2af250d20c873cdbee8ff958fb809940aeb2e74ba5f20aaf6b7ac8c70c"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b4f15793aa49793ec8d1c708ab7f9eded1aa72edc5174cae703651555ed1b601"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e5542339dcf2747135c5c85f68680353d5cb9ffd741c0f2e8d832d054d41f35a"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5c401e05ad47a75869c3ab3e35137f8468b846770587e70d71e11de797d113df"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:243dda95d901c733f5b59214d28b0120893d91777cb8aa043e6ef059d3cddfe2"},
- {file = "yarl-1.22.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bec03d0d388060058f5d291a813f21c011041938a441c593374da6077fe21b1b"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b0748275abb8c1e1e09301ee3cf90c8a99678a4e92e4373705f2a2570d581273"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:47fdb18187e2a4e18fda2c25c05d8251a9e4a521edaed757fef033e7d8498d9a"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c7044802eec4524fde550afc28edda0dd5784c4c45f0be151a2d3ba017daca7d"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:139718f35149ff544caba20fce6e8a2f71f1e39b92c700d8438a0b1d2a631a02"},
- {file = "yarl-1.22.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e1b51bebd221006d3d2f95fbe124b22b247136647ae5dcc8c7acafba66e5ee67"},
- {file = "yarl-1.22.0-cp313-cp313-win32.whl", hash = "sha256:d3e32536234a95f513bd374e93d717cf6b2231a791758de6c509e3653f234c95"},
- {file = "yarl-1.22.0-cp313-cp313-win_amd64.whl", hash = "sha256:47743b82b76d89a1d20b83e60d5c20314cbd5ba2befc9cda8f28300c4a08ed4d"},
- {file = "yarl-1.22.0-cp313-cp313-win_arm64.whl", hash = "sha256:5d0fcda9608875f7d052eff120c7a5da474a6796fe4d83e152e0e4d42f6d1a9b"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:719ae08b6972befcba4310e49edb1161a88cdd331e3a694b84466bd938a6ab10"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:47d8a5c446df1c4db9d21b49619ffdba90e77c89ec6e283f453856c74b50b9e3"},
- {file = "yarl-1.22.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:cfebc0ac8333520d2d0423cbbe43ae43c8838862ddb898f5ca68565e395516e9"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4398557cbf484207df000309235979c79c4356518fd5c99158c7d38203c4da4f"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2ca6fd72a8cd803be290d42f2dec5cdcd5299eeb93c2d929bf060ad9efaf5de0"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ca1f59c4e1ab6e72f0a23c13fca5430f889634166be85dbf1013683e49e3278e"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:6c5010a52015e7c70f86eb967db0f37f3c8bd503a695a49f8d45700144667708"},
- {file = "yarl-1.22.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d7672ecf7557476642c88497c2f8d8542f8e36596e928e9bcba0e42e1e7d71f"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:3b7c88eeef021579d600e50363e0b6ee4f7f6f728cd3486b9d0f3ee7b946398d"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_armv7l.whl", hash = "sha256:f4afb5c34f2c6fecdcc182dfcfc6af6cccf1aa923eed4d6a12e9d96904e1a0d8"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:59c189e3e99a59cf8d83cbb31d4db02d66cda5a1a4374e8a012b51255341abf5"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:5a3bf7f62a289fa90f1990422dc8dff5a458469ea71d1624585ec3a4c8d6960f"},
- {file = "yarl-1.22.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:de6b9a04c606978fdfe72666fa216ffcf2d1a9f6a381058d4378f8d7b1e5de62"},
- {file = "yarl-1.22.0-cp313-cp313t-win32.whl", hash = "sha256:1834bb90991cc2999f10f97f5f01317f99b143284766d197e43cd5b45eb18d03"},
- {file = "yarl-1.22.0-cp313-cp313t-win_amd64.whl", hash = "sha256:ff86011bd159a9d2dfc89c34cfd8aff12875980e3bd6a39ff097887520e60249"},
- {file = "yarl-1.22.0-cp313-cp313t-win_arm64.whl", hash = "sha256:7861058d0582b847bc4e3a4a4c46828a410bca738673f35a29ba3ca5db0b473b"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:34b36c2c57124530884d89d50ed2c1478697ad7473efd59cfd479945c95650e4"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:0dd9a702591ca2e543631c2a017e4a547e38a5c0f29eece37d9097e04a7ac683"},
- {file = "yarl-1.22.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:594fcab1032e2d2cc3321bb2e51271e7cd2b516c7d9aee780ece81b07ff8244b"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f3d7a87a78d46a2e3d5b72587ac14b4c16952dd0887dbb051451eceac774411e"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:852863707010316c973162e703bddabec35e8757e67fcb8ad58829de1ebc8590"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:131a085a53bfe839a477c0845acf21efc77457ba2bcf5899618136d64f3303a2"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:078a8aefd263f4d4f923a9677b942b445a2be970ca24548a8102689a3a8ab8da"},
- {file = "yarl-1.22.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bca03b91c323036913993ff5c738d0842fc9c60c4648e5c8d98331526df89784"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:68986a61557d37bb90d3051a45b91fa3d5c516d177dfc6dd6f2f436a07ff2b6b"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:4792b262d585ff0dff6bcb787f8492e40698443ec982a3568c2096433660c694"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:ebd4549b108d732dba1d4ace67614b9545b21ece30937a63a65dd34efa19732d"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:f87ac53513d22240c7d59203f25cc3beac1e574c6cd681bbfd321987b69f95fd"},
- {file = "yarl-1.22.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:22b029f2881599e2f1b06f8f1db2ee63bd309e2293ba2d566e008ba12778b8da"},
- {file = "yarl-1.22.0-cp314-cp314-win32.whl", hash = "sha256:6a635ea45ba4ea8238463b4f7d0e721bad669f80878b7bfd1f89266e2ae63da2"},
- {file = "yarl-1.22.0-cp314-cp314-win_amd64.whl", hash = "sha256:0d6e6885777af0f110b0e5d7e5dda8b704efed3894da26220b7f3d887b839a79"},
- {file = "yarl-1.22.0-cp314-cp314-win_arm64.whl", hash = "sha256:8218f4e98d3c10d683584cb40f0424f4b9fd6e95610232dd75e13743b070ee33"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:45c2842ff0e0d1b35a6bf1cd6c690939dacb617a70827f715232b2e0494d55d1"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:d947071e6ebcf2e2bee8fce76e10faca8f7a14808ca36a910263acaacef08eca"},
- {file = "yarl-1.22.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:334b8721303e61b00019474cc103bdac3d7b1f65e91f0bfedeec2d56dfe74b53"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e7ce67c34138a058fd092f67d07a72b8e31ff0c9236e751957465a24b28910c"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:d77e1b2c6d04711478cb1c4ab90db07f1609ccf06a287d5607fcd90dc9863acf"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c4647674b6150d2cae088fc07de2738a84b8bcedebef29802cf0b0a82ab6face"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:efb07073be061c8f79d03d04139a80ba33cbd390ca8f0297aae9cce6411e4c6b"},
- {file = "yarl-1.22.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e51ac5435758ba97ad69617e13233da53908beccc6cfcd6c34bbed8dcbede486"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:33e32a0dd0c8205efa8e83d04fc9f19313772b78522d1bdc7d9aed706bfd6138"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:bf4a21e58b9cde0e401e683ebd00f6ed30a06d14e93f7c8fd059f8b6e8f87b6a"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:e4b582bab49ac33c8deb97e058cd67c2c50dac0dd134874106d9c774fd272529"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:0b5bcc1a9c4839e7e30b7b30dd47fe5e7e44fb7054ec29b5bb8d526aa1041093"},
- {file = "yarl-1.22.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c0232bce2170103ec23c454e54a57008a9a72b5d1c3105dc2496750da8cfa47c"},
- {file = "yarl-1.22.0-cp314-cp314t-win32.whl", hash = "sha256:8009b3173bcd637be650922ac455946197d858b3630b6d8787aa9e5c4564533e"},
- {file = "yarl-1.22.0-cp314-cp314t-win_amd64.whl", hash = "sha256:9fb17ea16e972c63d25d4a97f016d235c78dd2344820eb35bc034bc32012ee27"},
- {file = "yarl-1.22.0-cp314-cp314t-win_arm64.whl", hash = "sha256:9f6d73c1436b934e3f01df1e1b21ff765cd1d28c77dfb9ace207f746d4610ee1"},
- {file = "yarl-1.22.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3aa27acb6de7a23785d81557577491f6c38a5209a254d1191519d07d8fe51748"},
- {file = "yarl-1.22.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:af74f05666a5e531289cb1cc9c883d1de2088b8e5b4de48004e5ca8a830ac859"},
- {file = "yarl-1.22.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:62441e55958977b8167b2709c164c91a6363e25da322d87ae6dd9c6019ceecf9"},
- {file = "yarl-1.22.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b580e71cac3f8113d3135888770903eaf2f507e9421e5697d6ee6d8cd1c7f054"},
- {file = "yarl-1.22.0-cp39-cp39-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e81fda2fb4a07eda1a2252b216aa0df23ebcd4d584894e9612e80999a78fd95b"},
- {file = "yarl-1.22.0-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:99b6fc1d55782461b78221e95fc357b47ad98b041e8e20f47c1411d0aacddc60"},
- {file = "yarl-1.22.0-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:088e4e08f033db4be2ccd1f34cf29fe994772fb54cfe004bbf54db320af56890"},
- {file = "yarl-1.22.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e4e1f6f0b4da23e61188676e3ed027ef0baa833a2e633c29ff8530800edccba"},
- {file = "yarl-1.22.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:84fc3ec96fce86ce5aa305eb4aa9358279d1aa644b71fab7b8ed33fe3ba1a7ca"},
- {file = "yarl-1.22.0-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:5dbeefd6ca588b33576a01b0ad58aa934bc1b41ef89dee505bf2932b22ddffba"},
- {file = "yarl-1.22.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:14291620375b1060613f4aab9ebf21850058b6b1b438f386cc814813d901c60b"},
- {file = "yarl-1.22.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:a4fcfc8eb2c34148c118dfa02e6427ca278bfd0f3df7c5f99e33d2c0e81eae3e"},
- {file = "yarl-1.22.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:029866bde8d7b0878b9c160e72305bbf0a7342bcd20b9999381704ae03308dc8"},
- {file = "yarl-1.22.0-cp39-cp39-win32.whl", hash = "sha256:4dcc74149ccc8bba31ce1944acee24813e93cfdee2acda3c172df844948ddf7b"},
- {file = "yarl-1.22.0-cp39-cp39-win_amd64.whl", hash = "sha256:10619d9fdee46d20edc49d3479e2f8269d0779f1b031e6f7c2aa1c76be04b7ed"},
- {file = "yarl-1.22.0-cp39-cp39-win_arm64.whl", hash = "sha256:dd7afd3f8b0bfb4e0d9fc3c31bfe8a4ec7debe124cfd90619305def3c8ca8cd2"},
- {file = "yarl-1.22.0-py3-none-any.whl", hash = "sha256:1380560bdba02b6b6c90de54133c81c9f2a453dee9912fe58c1dcced1edb7cff"},
- {file = "yarl-1.22.0.tar.gz", hash = "sha256:bebf8557577d4401ba8bd9ff33906f1376c877aa78d1fe216ad01b4d6745af71"},
-]
-
-[package.dependencies]
-idna = ">=2.0"
-multidict = ">=4.0"
-propcache = ">=0.2.1"
-
[[package]]
name = "zipp"
version = "3.23.0"
@@ -2912,4 +1630,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<4.0"
-content-hash = "e0936a065565550afed18f6298b7e04e814b44100def7049f1a0d68662624a39"
+content-hash = "ed52bcfc3cea8347fc133485d4db0ed112a41bfed2de67c9ace66b003d6d1ef1"
diff --git a/autogpt_platform/autogpt_libs/pyproject.toml b/autogpt_platform/autogpt_libs/pyproject.toml
index 0bc1fd8145..7f665c457a 100644
--- a/autogpt_platform/autogpt_libs/pyproject.toml
+++ b/autogpt_platform/autogpt_libs/pyproject.toml
@@ -13,20 +13,18 @@ cryptography = "^46.0"
expiringdict = "^1.2.2"
fastapi = "^0.128.7"
google-cloud-logging = "^3.13.0"
-launchdarkly-server-sdk = "^9.15.0"
pydantic = "^2.12.5"
pydantic-settings = "^2.12.0"
pyjwt = { version = "^2.11.0", extras = ["crypto"] }
redis = "^6.2.0"
-supabase = "^2.28.0"
-uvicorn = "^0.40.0"
[tool.poetry.group.dev.dependencies]
+httpx = "^0.28.1"
pyright = "^1.1.408"
pytest = "^8.4.1"
pytest-asyncio = "^1.3.0"
-pytest-mock = "^3.15.1"
pytest-cov = "^7.1.0"
+pytest-mock = "^3.15.1"
ruff = "^0.15.7"
[build-system]
@@ -38,3 +36,7 @@ line-length = 88
[tool.ruff.lint]
extend-select = ["I"] # sort dependencies
+
+[tool.pytest.ini_options]
+# Run bare `async def` tests without a per-test marker, matching the backend.
+asyncio_mode = "auto"
diff --git a/autogpt_platform/backend/.env.default b/autogpt_platform/backend/.env.default
index 5275b51c3e..3669aeeee8 100644
--- a/autogpt_platform/backend/.env.default
+++ b/autogpt_platform/backend/.env.default
@@ -27,9 +27,26 @@ REDIS_PORT=17000
RABBITMQ_DEFAULT_USER=rabbitmq_user_default
RABBITMQ_DEFAULT_PASS=k0VMxyIJF9S35f3x2uaw5IWAl6Y536O7
-# Supabase Authentication
-SUPABASE_URL=http://localhost:8000
-SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
+# Authentication
+# JWKS endpoint of the Better Auth service embedded in the frontend.
+# Asymmetric (ES256) JWTs are verified against the keys published here.
+#
+# Transport security: the backend trusts whatever signing keys this URL returns,
+# so the fetch must run over a trusted path. Plain http is fine for localhost and
+# for container-to-container traffic on a single host (e.g. the default
+# http://frontend:3000 over the Docker network). Over an UNTRUSTED network
+# (backend and frontend on separate LAN machines, or a public host) use https:
+# a cleartext fetch there lets a network attacker substitute the keys and forge
+# tokens. For LAN setups, put the frontend behind TLS or use locally-trusted
+# certs (e.g. mkcert). See the self-hosting guide's security note.
+JWT_JWKS_URL=http://localhost:3000/api/auth/jwks
+# The backend refuses to start if JWT_JWKS_URL is cleartext http:// to a
+# non-local host, since an attacker in the path could substitute the keys and
+# forge tokens. Set this to true to boot anyway on a trusted network path
+# (a startup warning stays on record).
+# JWKS_ALLOW_INSECURE_TRANSPORT=false
+# Legacy shared-secret verification (HS256). Only needed while sessions issued
+# by Supabase GoTrue are still in circulation; safe to remove afterwards.
JWT_VERIFY_KEY=your-super-secret-jwt-token-with-at-least-32-characters-long
## ===== REQUIRED SECURITY KEYS ===== ##
@@ -58,6 +75,10 @@ VAPID_CLAIM_EMAIL=mailto:[email protected]
# Platform URLs (set these for webhooks and OAuth to work)
PLATFORM_BASE_URL=http://localhost:8000
FRONTEND_BASE_URL=http://localhost:3000
+# Extra frontend origins (beyond FRONTEND_BASE_URL) that auth-email action
+# links may target — JSON list of full origins or "regex:"-prefixed patterns,
+# same format as BACKEND_CORS_ALLOW_ORIGINS. Self-hosting needs nothing here.
+# TRUSTED_FRONTEND_ORIGINS=["regex:https://autogpt-pr-\\d+\\.vercel\\.app"]
# Media Storage (required for marketplace and library functionality)
MEDIA_GCS_BUCKET_NAME=
@@ -193,6 +214,9 @@ STRIPE_API_KEY=
STRIPE_WEBHOOK_SECRET=
# Email Service (for sending notifications and confirmations)
+# Better Auth password-reset / verification emails also send through this
+# Postmark mailer via POST /api/auth-email/send, authenticated by short-lived
+# frontend service tokens verified against JWT_JWKS_URL — no extra secret.
POSTMARK_SERVER_API_TOKEN=
POSTMARK_WEBHOOK_TOKEN=
diff --git a/autogpt_platform/backend/backend/api/features/auth_email/__init__.py b/autogpt_platform/backend/backend/api/features/auth_email/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/autogpt_platform/backend/backend/api/features/auth_email/routes.py b/autogpt_platform/backend/backend/api/features/auth_email/routes.py
new file mode 100644
index 0000000000..0b44cbdee4
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/auth_email/routes.py
@@ -0,0 +1,152 @@
+"""Backend endpoint for Better Auth transactional emails.
+
+Better Auth runs in the Next.js frontend (Vercel), which deliberately holds no
+email/Postmark credentials. Rather than a frontend SMTP transport, its
+``sendResetPassword`` / ``sendVerificationEmail`` hooks POST here with a
+short-lived frontend service token — signed with the same Better Auth JWKS
+key the backend already trusts for user tokens — and this endpoint forwards
+the message to the notification service, which owns the Postmark credential
+(the REST API pod holds none). The subject/body are built server-side from a
+fixed set of ``type``s (never free-form input), so even a captured token can
+only trigger our own templated auth emails, and the action link is restricted
+to our own hosts.
+"""
+
+import asyncio
+import html
+import logging
+import re
+from typing import Literal
+from urllib.parse import urlparse
+
+from autogpt_libs.auth import requires_frontend_service
+from fastapi import APIRouter, HTTPException, Security, status
+from pydantic import BaseModel, EmailStr
+
+from backend.util.clients import get_notification_manager_client
+from backend.util.settings import Settings
+
+logger = logging.getLogger(__name__)
+settings = Settings()
+
+auth_email_router = APIRouter()
+
+# Module-level so tests can override the exact dependency instance.
+requires_auth_email_service = requires_frontend_service("auth-email:send")
+
+_SUBJECTS: dict[str, str] = {
+ "reset_password": "Reset your AutoGPT Platform password",
+ "verify_email": "Verify your AutoGPT Platform email",
+ "change_email": "Confirm your new AutoGPT Platform email",
+}
+
+_ACTIONS: dict[str, str] = {
+ "reset_password": "reset your password",
+ "verify_email": "verify your email",
+ "change_email": "confirm your new email address",
+}
+
+
+class AuthEmailRequest(BaseModel):
+ type: Literal["reset_password", "verify_email", "change_email"]
+ to: EmailStr
+ url: str
+
+
+@auth_email_router.post(
+ "/send",
+ status_code=status.HTTP_204_NO_CONTENT,
+ dependencies=[Security(requires_auth_email_service)],
+ summary="Send a Better Auth transactional email via the backend mailer",
+ # Without an explicit id the generated client name is derived from the
+ # summary, which produces an unreadable mouthful.
+ operation_id="sendAuthTransactionalEmail",
+ responses={
+ 400: {"description": "url does not point at a trusted frontend origin"},
+ 403: {"description": "Service token is missing the required scope"},
+ 503: {"description": "Service-token verification is not configured"},
+ },
+ # The tag comes from the router include in rest_api.py; repeating it here
+ # duplicates it in the generated spec.
+)
+async def send_auth_email(request: AuthEmailRequest) -> None:
+ if not _url_origin_allowed(request.url):
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="url must point at a trusted frontend origin.",
+ )
+
+ subject = _SUBJECTS[request.type]
+ action = _ACTIONS[request.type]
+ # Escape the (host-validated) URL before embedding it in HTML — a path or
+ # query on an allowed host could still carry markup-breaking characters.
+ safe_url = html.escape(request.url, quote=True)
+ body = (
+ f"<p>Click the link below to {action} for the AutoGPT Platform:</p>"
+ f'<p><a href="{safe_url}">{safe_url}</a></p>'
+ "<p>If you didn't request this, you can safely ignore this email.</p>"
+ )
+
+ # The blocking RPC to the notification service runs off the event loop; a
+ # delivery failure there surfaces as a 5xx so a misconfigured mailer fails
+ # loudly instead of dropping the auth email.
+ await asyncio.to_thread(
+ get_notification_manager_client().send_email_or_raise,
+ request.to,
+ subject,
+ body,
+ )
+ # Don't log the recipient address — auth emails go to arbitrary users and
+ # the address is PII we don't want in application logs.
+ logger.info(f"Sent {request.type} auth email")
+
+
+def _url_origin_allowed(url: str) -> bool:
+ """Only send links pointing at a trusted frontend origin (frontend_base_url
+ or an entry in trusted_frontend_origins). Blocks a token-holder from
+ sending phishing links to arbitrary domains. Self-hosting works with just
+ frontend_base_url; there is no hardcoded provider wildcard."""
+ origin = _origin_of(url)
+ if origin is None:
+ return False
+ exact, patterns = _trusted_frontend_origins()
+ if origin in exact:
+ return True
+ return any(re.fullmatch(pattern, origin) for pattern in patterns)
+
+
+def _trusted_frontend_origins() -> tuple[set[str], list[str]]:
+ """The set of frontend origins auth-email links may target: the configured
+ frontend_base_url plus any trusted_frontend_origins. Returns (exact origins,
+ regex patterns)."""
+ entries: list[str] = []
+ frontend_origin = _origin_of(settings.config.frontend_base_url)
+ if frontend_origin:
+ entries.append(frontend_origin)
+ entries.extend(settings.config.trusted_frontend_origins)
+
+ # Normalize configured origins through the same parser as the incoming URL,
+ # so an explicit default port on either side can't cause a false mismatch.
+ exact = {_origin_of(e) or e for e in entries if not e.startswith("regex:")}
+ patterns = [e[len("regex:") :] for e in entries if e.startswith("regex:")]
+ return exact, patterns
+
+
+_DEFAULT_PORTS = {"http": 80, "https": 443}
+
+
+def _origin_of(url: str) -> str | None:
+ """Return the scheme://host[:port] origin of an http(s) URL, or None.
+ Built from hostname/port (not netloc) so embedded credentials in a crafted
+ URL can't smuggle a different effective host past the allowlist.
+
+ A port that is the scheme's default is dropped, because urlparse keeps an
+ explicit one: without this, `https://app.example:443/reset` and
+ `https://app.example` produce different origins and the comparison below
+ fails closed, refusing to send a legitimate auth email."""
+ parsed = urlparse(url)
+ if parsed.scheme not in ("http", "https") or not parsed.hostname:
+ return None
+ port = parsed.port
+ suffix = "" if port is None or port == _DEFAULT_PORTS[parsed.scheme] else f":{port}"
+ return f"{parsed.scheme}://{parsed.hostname}{suffix}"
diff --git a/autogpt_platform/backend/backend/api/features/auth_email/routes_test.py b/autogpt_platform/backend/backend/api/features/auth_email/routes_test.py
new file mode 100644
index 0000000000..37959a063c
--- /dev/null
+++ b/autogpt_platform/backend/backend/api/features/auth_email/routes_test.py
@@ -0,0 +1,210 @@
+import os
+from unittest.mock import MagicMock
+
+import fastapi
+import fastapi.testclient
+import pytest
+from autogpt_libs.auth import config as auth_config
+from autogpt_libs.auth.config import Settings as AuthSettings
+from pytest_mock import MockerFixture
+
+from backend.api.features.auth_email import routes as auth_email_routes
+
+app = fastapi.FastAPI()
+# Mirror the prefix rest_api.py mounts it under, so these tests exercise the
+# same paths the service actually serves.
+app.include_router(auth_email_routes.auth_email_router, prefix="/api/auth/email")
+client = fastapi.testclient.TestClient(app, raise_server_exceptions=False)
+
+VALID_BODY = {
+ "type": "reset_password",
+ "url": "https://platform.agpt.co/reset-password?token=abc",
+}
+
+
+def send_mock(monkeypatch):
+ """Bypass service-token auth (covered by autogpt_libs service_test) and
+ capture the send forwarded to the notification service."""
+ app.dependency_overrides[auth_email_routes.requires_auth_email_service] = (
+ lambda: None
+ )
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "frontend_base_url",
+ "https://platform.agpt.co",
+ )
+ # Deterministic: no extra trusted origins unless a test sets them.
+ monkeypatch.setattr(
+ auth_email_routes.settings.config, "trusted_frontend_origins", []
+ )
+ mock = MagicMock()
+ monkeypatch.setattr(
+ auth_email_routes,
+ "get_notification_manager_client",
+ lambda: MagicMock(send_email_or_raise=mock),
+ )
+ yield mock
+ app.dependency_overrides.clear()
+
+
+def _post(body=None):
+ return client.post("/api/auth/email/send", json=body or VALID_BODY)
+
+
+def test_valid_request_sends_and_returns_204(send_mock):
+ res = _post()
+ assert res.status_code == 204
+ send_mock.assert_called_once()
+ to, subject, body = send_mock.call_args.args
+ assert to == "[email protected]"
+ assert "Reset your AutoGPT Platform password" == subject
+ assert VALID_BODY["url"] in body
+
+
+def test_rejects_link_on_untrusted_host(send_mock):
+ res = _post({**VALID_BODY, "url": "https://evil.example.com/reset"})
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_rejects_scheme_mismatch(send_mock):
+ # http origin != the trusted https frontend origin.
+ res = _post({**VALID_BODY, "url": "http://platform.agpt.co/reset"})
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_rejects_url_with_embedded_credentials(send_mock):
+ # userinfo must not smuggle a different effective host past the check.
+ res = _post(
+ {**VALID_BODY, "url": "https://[email protected]/reset"}
+ )
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_rejects_arbitrary_vercel_host_without_config(send_mock):
+ # No hardcoded *.vercel.app blanket anymore: an arbitrary vercel app is
+ # rejected unless explicitly configured.
+ res = _post({**VALID_BODY, "url": "https://attacker.vercel.app/reset"})
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_allows_configured_preview_regex(send_mock, monkeypatch):
+ # Cloud configures a tight preview pattern (not a blanket wildcard).
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "trusted_frontend_origins",
+ [r"regex:https://autogpt-pr-\d+\.vercel\.app"],
+ )
+ res = _post(
+ {**VALID_BODY, "url": "https://autogpt-pr-13330.vercel.app/reset-password"}
+ )
+ assert res.status_code == 204
+ send_mock.assert_called_once()
+
+ # A vercel host that doesn't match the pattern is still rejected.
+ send_mock.reset_mock()
+ res = _post({**VALID_BODY, "url": "https://autogpt-pr-13330.evil.app/x"})
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_allows_exact_configured_origin(send_mock, monkeypatch):
+ # Self-host style: an explicit extra origin (e.g. a custom domain).
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "trusted_frontend_origins",
+ ["https://app.selfhosted.example:8443"],
+ )
+ res = _post(
+ {**VALID_BODY, "url": "https://app.selfhosted.example:8443/reset?token=x"}
+ )
+ assert res.status_code == 204
+ send_mock.assert_called_once()
+
+
+def test_rejects_unknown_type(send_mock):
+ res = _post({**VALID_BODY, "type": "spam_blast"})
+ assert res.status_code == 422 # pydantic Literal rejection
+ send_mock.assert_not_called()
+
+
+def test_unauthenticated_request_is_401(mocker: MockerFixture, monkeypatch):
+ """Without a frontend service token the route must refuse — proves the
+ Security dependency is actually wired to the endpoint."""
+ mocker.patch.dict(
+ os.environ,
+ {"JWT_JWKS_URL": "http://localhost:3000/api/auth/jwks"},
+ clear=False,
+ )
+ mocker.patch.object(auth_config, "_settings", AuthSettings())
+ send = MagicMock()
+ monkeypatch.setattr(
+ auth_email_routes,
+ "get_notification_manager_client",
+ lambda: MagicMock(send_email_or_raise=send),
+ )
+
+ res = _post()
+
+ assert res.status_code == 401
+ send.assert_not_called()
+
+
+def test_allows_origin_with_explicit_default_port(send_mock, monkeypatch):
+ """An explicit :443 must not read as a different origin than the bare host.
+
+ urlparse keeps an explicit default port, so without normalization the
+ comparison fails closed and a legitimate reset email is never sent.
+ """
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "trusted_frontend_origins",
+ ["https://app.selfhosted.example"],
+ )
+ res = _post(
+ {**VALID_BODY, "url": "https://app.selfhosted.example:443/reset?token=x"}
+ )
+ assert res.status_code == 204
+ send_mock.assert_called_once()
+
+
+def test_allows_configured_origin_carrying_a_default_port(send_mock, monkeypatch):
+ """...and the same when the explicit port is on the configured side."""
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "trusted_frontend_origins",
+ ["https://app.selfhosted.example:443"],
+ )
+ res = _post({**VALID_BODY, "url": "https://app.selfhosted.example/reset?token=x"})
+ assert res.status_code == 204
+ send_mock.assert_called_once()
+
+
+def test_non_default_port_still_distinguishes_origins(send_mock, monkeypatch):
+ """Normalizing default ports must not collapse genuinely different ones."""
+ monkeypatch.setattr(
+ auth_email_routes.settings.config,
+ "trusted_frontend_origins",
+ ["https://app.selfhosted.example:8443"],
+ )
+ res = _post({**VALID_BODY, "url": "https://app.selfhosted.example:9443/reset"})
+ assert res.status_code == 400
+ send_mock.assert_not_called()
+
+
+def test_rejects_malformed_trusted_origin_regex_at_startup():
+ """A bad pattern must fail at config time, not on every email send."""
+ import pytest
+
+ from backend.util.settings import Config
+
+ with pytest.raises(ValueError, match="Invalid regex pattern"):
+ Config(trusted_frontend_origins=["regex:https://(unclosed"])
+
+ with pytest.raises(ValueError, match="cannot be empty"):
+ Config(trusted_frontend_origins=["regex:"])
diff --git a/autogpt_platform/backend/backend/api/rest_api.py b/autogpt_platform/backend/backend/api/rest_api.py
index 92f145abad..76136f1179 100644
--- a/autogpt_platform/backend/backend/api/rest_api.py
+++ b/autogpt_platform/backend/backend/api/rest_api.py
@@ -25,6 +25,7 @@ import backend.api.features.admin.memory_admin_routes
import backend.api.features.admin.platform_cost_routes
import backend.api.features.admin.rate_limit_admin_routes
import backend.api.features.admin.store_admin_routes
+import backend.api.features.auth_email.routes as auth_email_routes
import backend.api.features.builder
import backend.api.features.builder.routes
import backend.api.features.chat.routes as chat_routes
@@ -345,6 +346,11 @@ app.add_exception_handler(PreconditionFailed, handle_internal_http_error(428))
app.add_exception_handler(Exception, handle_internal_http_error(500))
app.include_router(backend.api.features.v1.v1_router, tags=["v1"], prefix="/api")
+app.include_router(
+ auth_email_routes.auth_email_router,
+ prefix="/api/auth/email",
+ tags=["auth-email"],
+)
app.include_router(
integrations_router,
prefix="/api/integrations",
diff --git a/autogpt_platform/backend/backend/api/ws_api.py b/autogpt_platform/backend/backend/api/ws_api.py
index e5e3267c11..f6c115d7f7 100644
--- a/autogpt_platform/backend/backend/api/ws_api.py
+++ b/autogpt_platform/backend/backend/api/ws_api.py
@@ -4,7 +4,7 @@ from typing import Protocol
import pydantic
import uvicorn
-from autogpt_libs.auth.jwt_utils import parse_jwt_token
+from autogpt_libs.auth.jwt_utils import parse_jwt_token_async
from fastapi import Depends, FastAPI, WebSocket, WebSocketDisconnect
from starlette.middleware.cors import CORSMiddleware
@@ -82,7 +82,7 @@ async def authenticate_websocket(websocket: WebSocket) -> str:
return ""
try:
- payload = parse_jwt_token(token)
+ payload = await parse_jwt_token_async(token)
user_id = payload.get("sub")
if not user_id:
await websocket.close(code=4002, reason="Invalid token")
diff --git a/autogpt_platform/backend/backend/api/ws_api_test.py b/autogpt_platform/backend/backend/api/ws_api_test.py
index 6ef694d1fd..b1d42da455 100644
--- a/autogpt_platform/backend/backend/api/ws_api_test.py
+++ b/autogpt_platform/backend/backend/api/ws_api_test.py
@@ -385,7 +385,8 @@ async def test_authenticate_websocket_invalid_token_closes_4003(mocker) -> None:
mocker.patch.object(settings.config, "enable_auth", True)
mocker.patch(
- "backend.api.ws_api.parse_jwt_token", side_effect=ValueError("bad token")
+ "backend.api.ws_api.parse_jwt_token_async",
+ new=AsyncMock(side_effect=ValueError("bad token")),
)
ws = AsyncMock(spec=WebSocket)
ws.query_params = {"token": "abc"}
@@ -402,7 +403,10 @@ async def test_authenticate_websocket_missing_sub_closes_4002(mocker) -> None:
from backend.api.ws_api import authenticate_websocket
mocker.patch.object(settings.config, "enable_auth", True)
- mocker.patch("backend.api.ws_api.parse_jwt_token", return_value={"not_sub": "x"})
+ mocker.patch(
+ "backend.api.ws_api.parse_jwt_token_async",
+ new=AsyncMock(return_value={"not_sub": "x"}),
+ )
ws = AsyncMock(spec=WebSocket)
ws.query_params = {"token": "abc"}
@@ -418,7 +422,10 @@ async def test_authenticate_websocket_happy_path_returns_sub(mocker) -> None:
from backend.api.ws_api import authenticate_websocket
mocker.patch.object(settings.config, "enable_auth", True)
- mocker.patch("backend.api.ws_api.parse_jwt_token", return_value={"sub": "user-X"})
+ mocker.patch(
+ "backend.api.ws_api.parse_jwt_token_async",
+ new=AsyncMock(return_value={"sub": "user-X"}),
+ )
ws = AsyncMock(spec=WebSocket)
ws.query_params = {"token": "abc"}
diff --git a/autogpt_platform/backend/backend/data/db_manager.py b/autogpt_platform/backend/backend/data/db_manager.py
index b8d7cf20b3..6d2ccfd820 100644
--- a/autogpt_platform/backend/backend/data/db_manager.py
+++ b/autogpt_platform/backend/backend/data/db_manager.py
@@ -132,6 +132,7 @@ from backend.data.understanding import (
)
from backend.data.user import (
get_active_user_ids_in_timerange,
+ get_auth_user_flag_fields,
get_user_by_id,
get_user_credentials,
get_user_email_by_id,
@@ -306,6 +307,9 @@ class DatabaseManager(AppService):
# ============ User + Integrations ============ #
get_user_by_id = _(get_user_by_id)
+ # Exposed so Prisma-less workers (scheduler, copilot-executor) can build a
+ # full LaunchDarkly context — see backend/util/feature_flag.py.
+ get_auth_user_flag_fields = _(get_auth_user_flag_fields)
get_user_integrations = _(get_user_integrations)
update_user_integrations = _(update_user_integrations)
get_user_credentials = _(get_user_credentials)
@@ -604,6 +608,7 @@ class DatabaseManagerAsyncClient(AppServiceClient):
# ============ User + Integrations ============ #
get_user_by_id = d.get_user_by_id
+ get_auth_user_flag_fields = d.get_auth_user_flag_fields
get_user_integrations = d.get_user_integrations
update_user_integrations = d.update_user_integrations
get_user_credentials = d.get_user_credentials
diff --git a/autogpt_platform/backend/backend/data/user.py b/autogpt_platform/backend/backend/data/user.py
index ee027406fc..f4ab41c8b8 100644
--- a/autogpt_platform/backend/backend/data/user.py
+++ b/autogpt_platform/backend/backend/data/user.py
@@ -13,6 +13,7 @@ from autogpt_libs.auth.models import DEFAULT_USER_ID
from fastapi import HTTPException
from prisma.enums import NotificationType
from prisma.errors import UniqueViolationError
+from prisma.models import AuthUser
from prisma.models import User as PrismaUser
from prisma.types import (
JsonFilter,
@@ -216,6 +217,37 @@ async def get_user_email_by_id(user_id: str) -> Optional[str]:
raise DatabaseError(f"Failed to get user email for user {user_id}: {e}") from e
+class AuthUserFlagFields(BaseModel):
+ """Minimal AuthUser attributes used to build a LaunchDarkly context.
+
+ A plain serializable shape (not an ``ldclient.Context``) so it can cross
+ the DatabaseManager RPC boundary — feature-flag evaluation runs in
+ Prisma-less workers (scheduler, copilot-executor) that reach the auth
+ table via the RPC client rather than a locally-connected Prisma engine.
+ """
+
+ role: Optional[str] = None
+ email: Optional[str] = None
+ created_at: Optional[datetime] = None
+
+
+async def get_auth_user_flag_fields(user_id: str) -> Optional[AuthUserFlagFields]:
+ """Fetch the AuthUser fields used for LaunchDarkly targeting.
+
+ Returns ``None`` when no auth row exists (e.g. mid auth-migration bridge
+ window) so the caller can avoid caching a not-found as an anonymous
+ context.
+ """
+ user = await AuthUser.prisma().find_unique(where={"id": user_id})
+ if user is None:
+ return None
+ return AuthUserFlagFields(
+ role=user.role,
+ email=user.email,
+ created_at=user.createdAt,
+ )
+
+
@cache_user_lookup
async def get_user_by_email(email: str) -> Optional[User]:
try:
diff --git a/autogpt_platform/backend/backend/data/user_test.py b/autogpt_platform/backend/backend/data/user_test.py
index caf1f20753..3873eea25b 100644
--- a/autogpt_platform/backend/backend/data/user_test.py
+++ b/autogpt_platform/backend/backend/data/user_test.py
@@ -499,3 +499,34 @@ class TestGetOrCreateUserPersonalOrg:
)
assert "org bootstrap exploded" in str(exc.value)
+
+
+class TestGetAuthUserFlagFields:
+ @pytest.mark.asyncio
+ async def test_returns_flag_fields_for_existing_auth_user(self):
+ created = datetime(2026, 5, 7, 12, 0, 0, tzinfo=timezone.utc)
+ auth_user = MagicMock(role="admin", email="[email protected]", createdAt=created)
+
+ with patch.object(user_module, "AuthUser") as mock_auth_user:
+ mock_auth_user.prisma.return_value.find_unique = AsyncMock(
+ return_value=auth_user
+ )
+ fields = await user_module.get_auth_user_flag_fields("user-1")
+
+ assert fields is not None
+ assert fields.role == "admin"
+ assert fields.email == "[email protected]"
+ assert fields.created_at == created
+ mock_auth_user.prisma.return_value.find_unique.assert_called_once_with(
+ where={"id": "user-1"}
+ )
+
+ @pytest.mark.asyncio
+ async def test_returns_none_when_auth_user_missing(self):
+ with patch.object(user_module, "AuthUser") as mock_auth_user:
+ mock_auth_user.prisma.return_value.find_unique = AsyncMock(
+ return_value=None
+ )
+ fields = await user_module.get_auth_user_flag_fields("ghost")
+
+ assert fields is None
diff --git a/autogpt_platform/backend/backend/notifications/email.py b/autogpt_platform/backend/backend/notifications/email.py
index 627a4060d2..17858fd034 100644
--- a/autogpt_platform/backend/backend/notifications/email.py
+++ b/autogpt_platform/backend/backend/notifications/email.py
@@ -134,6 +134,15 @@ class EmailSender:
base_template=base_template,
)
+ def send_email_or_raise(self, user_email: str, subject: str, body: str) -> None:
+ """Send a one-off transactional email (e.g. Better Auth password-reset
+ and verification links) with no notification templating or preference
+ gating. Raises if the Postmark client is not configured so callers can
+ surface the failure instead of silently dropping an auth email."""
+ if not self.postmark:
+ raise RuntimeError("Postmark is not configured; cannot send email")
+ self._send_email(user_email, subject, body)
+
def _send_email(
self,
user_email: str,
diff --git a/autogpt_platform/backend/backend/notifications/notifications.py b/autogpt_platform/backend/backend/notifications/notifications.py
index 6fbbe13e8a..efd1c971a9 100644
--- a/autogpt_platform/backend/backend/notifications/notifications.py
+++ b/autogpt_platform/backend/backend/notifications/notifications.py
@@ -440,6 +440,19 @@ class NotificationManager(AppService):
except Exception as e:
logger.warning(f"Failed to send Discord system alert: {e}")
+ @expose
+ async def send_email_or_raise(self, to: str, subject: str, body: str):
+ """Send a one-off transactional email (e.g. Better Auth password-reset
+ links forwarded by the REST API) through this service's Postmark
+ credential. Deliberately not wrapped in try/except: a delivery failure
+ must propagate to the RPC caller so it can surface the error instead
+ of reporting "email sent" for an undeliverable message."""
+ # send_email_or_raise wraps a blocking Postmark HTTP call; run it off
+ # the event loop so it can't stall the notification service.
+ await asyncio.to_thread(
+ self.email_sender.send_email_or_raise, to, subject, body
+ )
+
async def _queue_scheduled_notification(self, event: SummaryParamsEventModel):
"""Queue a scheduled notification - exposed method for other services to call"""
try:
@@ -1189,3 +1202,4 @@ class NotificationManagerClient(AppServiceClient):
)
queue_weekly_summary = endpoint_to_sync(NotificationManager.queue_weekly_summary)
discord_system_alert = endpoint_to_sync(NotificationManager.discord_system_alert)
+ send_email_or_raise = endpoint_to_sync(NotificationManager.send_email_or_raise)
diff --git a/autogpt_platform/backend/backend/util/architecture_test.py b/autogpt_platform/backend/backend/util/architecture_test.py
index cffb2e4873..249ed797ac 100644
--- a/autogpt_platform/backend/backend/util/architecture_test.py
+++ b/autogpt_platform/backend/backend/util/architecture_test.py
@@ -18,7 +18,7 @@ BACKEND_ROOT = pathlib.Path(__file__).resolve().parents[1]
#
# Motivation: `backend.util.cache.cached` stores its result in a process-wide
# dict for ttl_seconds. Async clients (AsyncOpenAI, httpx.AsyncClient,
-# AsyncRabbitMQ, supabase AClient, ...) wrap connection pools whose internal
+# AsyncRabbitMQ, ...) wrap connection pools whose internal
# asyncio primitives lazily bind to the first event loop that uses them. The
# executor runs two long-lived loops on separate threads; once the cache is
# populated from loop A, any subsequent call from loop B raises
@@ -34,7 +34,6 @@ LOOP_BOUND_TYPES = frozenset(
"LangfuseAsyncOpenAI",
"AsyncClient", # httpx, openai internal
"AsyncRabbitMQ",
- "AClient", # supabase async
"AsyncRedisExecutionEventBus",
}
)
@@ -43,7 +42,6 @@ LOOP_BOUND_TYPES = frozenset(
# so the rule can still catch NEW violations without blocking unrelated PRs.
_KNOWN_OFFENDERS = frozenset(
{
- "util/clients.py get_async_supabase",
"util/clients.py get_openai_client",
# Inner helper extracted from ``get_openai_client`` so the local-
# transport branch shares one cached client across both
diff --git a/autogpt_platform/backend/backend/util/clients.py b/autogpt_platform/backend/backend/util/clients.py
index fe5e763570..4d35b3fa1d 100644
--- a/autogpt_platform/backend/backend/util/clients.py
+++ b/autogpt_platform/backend/backend/util/clients.py
@@ -14,7 +14,6 @@ settings = Settings()
if TYPE_CHECKING:
from anthropic import AsyncAnthropic
from openai import AsyncOpenAI
- from supabase import AClient, Client
from backend.copilot.bot.app import CoPilotChatBridgeClient
from backend.data.db_manager import (
@@ -157,29 +156,6 @@ def get_integration_credentials_store() -> "IntegrationCredentialsStore":
return IntegrationCredentialsStore()
-# ============ Supabase Clients ============ #
-
-
-@cached(ttl_seconds=3600)
-def get_supabase() -> "Client":
- """Get a process-cached synchronous Supabase client instance."""
- from supabase import create_client
-
- return create_client(
- settings.secrets.supabase_url, settings.secrets.supabase_service_role_key
- )
-
-
-@cached(ttl_seconds=3600)
-async def get_async_supabase() -> "AClient":
- """Get a process-cached asynchronous Supabase client instance."""
- from supabase import create_async_client
-
- return await create_async_client(
- settings.secrets.supabase_url, settings.secrets.supabase_service_role_key
- )
-
-
# ============ OpenAI Client ============ #
diff --git a/autogpt_platform/backend/backend/util/feature_flag.py b/autogpt_platform/backend/backend/util/feature_flag.py
index 7d49d6d3d2..80a192be33 100644
--- a/autogpt_platform/backend/backend/util/feature_flag.py
+++ b/autogpt_platform/backend/backend/util/feature_flag.py
@@ -197,15 +197,14 @@ def shutdown_launchdarkly() -> None:
async def _fetch_user_context_data(user_id: str) -> Context:
"""
- Fetch user context for LaunchDarkly from Supabase.
-
- Successful lookups are cached for 24h (see
- ``_fetch_supabase_user_context``). Failed lookups are NOT cached: the
- degraded anonymous fallback is built outside the cache so the next
- evaluation retries Supabase instead of pinning this process to an
- email-less context for a full TTL — which would make its
- email/role-targeted flag evaluations silently diverge from peer
- processes. The degraded path costs one failed Supabase call per
+ Fetch user context for LaunchDarkly from the auth user table.
+
+ Successful lookups are cached for 24h (see ``_fetch_user_context``).
+ Failed lookups are NOT cached: the degraded anonymous fallback is built
+ outside the cache so the next evaluation retries the lookup instead of
+ pinning this process to an email-less context for a full TTL — which
+ would make its email/role-targeted flag evaluations silently diverge
+ from peer processes. The degraded path costs one failed lookup per
evaluation; bounded, and acceptable versus a 24h-poisoned cache.
Args:
@@ -217,11 +216,11 @@ async def _fetch_user_context_data(user_id: str) -> Context:
try:
uuid.UUID(user_id)
except ValueError:
- # Non-UUID key (e.g. "system") — skip Supabase lookup, return anonymous context.
+ # Non-UUID key (e.g. "system") — skip user lookup, return anonymous context.
return _anonymous_context(user_id)
try:
- return await _fetch_supabase_user_context(user_id)
+ return await _fetch_user_context(user_id)
except Exception as e:
logger.warning(
f"Failed to fetch user context for {user_id}: {e} — "
@@ -238,34 +237,43 @@ def _anonymous_context(user_id: str) -> Context:
@cached(maxsize=1000, ttl_seconds=86400) # 1000 entries, 24 hours TTL
-async def _fetch_supabase_user_context(user_id: str) -> Context:
+async def _fetch_user_context(user_id: str) -> Context:
"""
- Build the full LaunchDarkly context for ``user_id`` from Supabase.
+ Build the full LaunchDarkly context for ``user_id`` from the auth user
+ table.
- Raises on Supabase lookup failure: ``@cached`` never stores results
- of calls that raise, so a degraded context can't be cached here —
- the caller handles the fallback outside the cache.
+ Raises on lookup failure: ``@cached`` never stores results of calls
+ that raise, so a degraded context can't be cached here — the caller
+ handles the fallback outside the cache.
"""
- from backend.util.clients import get_supabase
-
- builder = Context.builder(user_id).kind("user").anonymous(True)
-
- # If we have user data, update context
- response = get_supabase().auth.admin.get_user_by_id(user_id)
- if response and response.user:
- user = response.user
- builder.anonymous(False)
- if user.role:
- builder.set("role", user.role)
- # It's weird, I know, but it is what it is.
- builder.set("custom", {"role": user.role})
- if user.email:
- builder.set("email", user.email)
- builder.set("email_domain", user.email.split("@")[-1])
- if user.created_at:
- # ISO-8601 string — LD supports RFC3339 date targeting on
- # this attribute (e.g. cohort users by signup window).
- builder.set("created_at", user.created_at.isoformat())
+ # Local import to avoid a util <-> data import cycle.
+ from backend.data.db_accessors import user_db
+
+ # user_db() falls back to the DatabaseManager RPC client in processes
+ # without a locally-connected Prisma client (scheduler, executors, ...).
+ fields = await user_db().get_auth_user_flag_fields(user_id)
+
+ if fields is None:
+ # Raise instead of returning an anonymous context: @cached would pin
+ # the anonymous result for 24h even after the user's row appears
+ # (possible during the auth-migration copy window). The caller falls
+ # back to an uncached anonymous context.
+ raise LookupError(f"No auth user row for {user_id}")
+
+ builder = Context.builder(user_id).kind("user").anonymous(False)
+ # Keep the same role values previously issued in JWTs so existing
+ # LaunchDarkly targeting rules keep matching.
+ role = "admin" if fields.role == "admin" else "authenticated"
+ builder.set("role", role)
+ # It's weird, I know, but it is what it is.
+ builder.set("custom", {"role": role})
+ if fields.email:
+ builder.set("email", fields.email)
+ builder.set("email_domain", fields.email.split("@")[-1])
+ if fields.created_at:
+ # ISO-8601 string — LD supports RFC3339 date targeting on
+ # this attribute (e.g. cohort users by signup window).
+ builder.set("created_at", fields.created_at.isoformat())
return builder.build()
@@ -299,7 +307,7 @@ async def get_feature_flag_value(
)
return default
- # Get user context from Supabase
+ # Get user context (role/email) from the Better Auth user table
context = await _fetch_user_context_data(user_id)
# Evaluate flag
diff --git a/autogpt_platform/backend/backend/util/feature_flag_test.py b/autogpt_platform/backend/backend/util/feature_flag_test.py
index e030a19257..6740ba8d72 100644
--- a/autogpt_platform/backend/backend/util/feature_flag_test.py
+++ b/autogpt_platform/backend/backend/util/feature_flag_test.py
@@ -177,58 +177,168 @@ class TestEnvFlagOverride:
class TestUserContext:
@staticmethod
- def _stub_supabase(mocker, *, created_at, role="authenticated", email="[email protected]"):
- user = mocker.MagicMock(role=role, email=email, created_at=created_at)
- response = mocker.MagicMock(user=user)
- supabase = mocker.MagicMock()
- supabase.auth.admin.get_user_by_id.return_value = response
- mocker.patch("backend.util.clients.get_supabase", return_value=supabase)
- return supabase
+ def _stub_flag_fields(mocker, *, created_at, role=None, email="[email protected]"):
+ """Stub the direct data-layer accessor with Prisma reported connected.
+
+ Returns the AsyncMock standing in for ``get_auth_user_flag_fields`` so
+ callers can assert on how it was invoked.
+ """
+ from backend.data.user import AuthUserFlagFields
+
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = True
+ fields = AuthUserFlagFields(role=role, email=email, created_at=created_at)
+ return mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(return_value=fields),
+ )
@pytest.mark.asyncio
async def test_context_includes_created_at_iso_string(self, mocker):
created = datetime.datetime(2026, 5, 7, 12, 0, 0, tzinfo=datetime.timezone.utc)
- supabase = self._stub_supabase(mocker, created_at=created)
+ accessor = self._stub_flag_fields(mocker, created_at=created)
user_id = str(uuid.uuid4())
ctx = await _fetch_user_context_data(user_id)
assert ctx.get("created_at") == created.isoformat()
assert ctx.get("email") == "[email protected]"
- supabase.auth.admin.get_user_by_id.assert_called_once_with(user_id)
+ accessor.assert_called_once_with(user_id)
@pytest.mark.asyncio
async def test_context_skips_created_at_when_missing(self, mocker):
- supabase = self._stub_supabase(mocker, created_at=None)
+ accessor = self._stub_flag_fields(mocker, created_at=None)
user_id = str(uuid.uuid4())
ctx = await _fetch_user_context_data(user_id)
assert "created_at" not in ctx.custom_attributes
assert ctx.get("email") == "[email protected]"
- supabase.auth.admin.get_user_by_id.assert_called_once_with(user_id)
+ accessor.assert_called_once_with(user_id)
+
+ @pytest.mark.asyncio
+ async def test_context_maps_admin_role_through(self, mocker):
+ self._stub_flag_fields(mocker, created_at=None, role="admin")
+
+ ctx = await _fetch_user_context_data(str(uuid.uuid4()))
+
+ assert ctx.get("role") == "admin"
+
+ @pytest.mark.asyncio
+ async def test_context_normalizes_non_admin_role_to_authenticated(self, mocker):
+ self._stub_flag_fields(mocker, created_at=None, role="user")
+
+ ctx = await _fetch_user_context_data(str(uuid.uuid4()))
+
+ assert ctx.get("role") == "authenticated"
+
+ @pytest.mark.asyncio
+ async def test_missing_user_falls_back_to_uncached_anonymous(self, mocker):
+ # A not-found user (e.g. mid auth-migration bridge window) must NOT be
+ # cached as anonymous — the inner lookup raises so @cached skips it and
+ # the caller returns an uncached anonymous context.
+ from backend.util import feature_flag as ff
+
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = True
+ mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(return_value=None),
+ )
+ user_id = str(uuid.uuid4())
+
+ with pytest.raises(LookupError):
+ await ff._fetch_user_context(user_id)
+
+ ctx = await _fetch_user_context_data(user_id)
+ assert ctx.get("email") is None
+ assert ctx.get("role") is None
+
+
+class TestUserContextConnectionRouting:
+ """The context lookup must reach the DB directly when Prisma is locally
+ connected, and through the DatabaseManager RPC client otherwise.
+
+ Prisma-less workers (scheduler, copilot-executor) previously hit a direct
+ Prisma call that raised ClientNotConnectedError and silently degraded the
+ LaunchDarkly context to anonymous.
+ """
+
+ @pytest.mark.asyncio
+ async def test_connected_uses_direct_accessor(self, mocker):
+ from backend.data.user import AuthUserFlagFields
+
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = True
+
+ fields = AuthUserFlagFields(role="admin", email="[email protected]", created_at=None)
+ direct = mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(return_value=fields),
+ )
+ rpc_client = mocker.MagicMock()
+ rpc_client.get_auth_user_flag_fields = mocker.AsyncMock(return_value=fields)
+ get_rpc_client = mocker.patch(
+ "backend.util.clients.get_database_manager_async_client",
+ return_value=rpc_client,
+ )
+ user_id = str(uuid.uuid4())
+
+ ctx = await _fetch_user_context_data(user_id)
+
+ assert ctx.get("role") == "admin"
+ direct.assert_called_once_with(user_id)
+ get_rpc_client.assert_not_called()
+ rpc_client.get_auth_user_flag_fields.assert_not_called()
+
+ @pytest.mark.asyncio
+ async def test_disconnected_routes_through_rpc_client(self, mocker):
+ from backend.data.user import AuthUserFlagFields
+
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = False
+
+ fields = AuthUserFlagFields(role="user", email="[email protected]", created_at=None)
+ direct = mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(return_value=fields),
+ )
+ rpc_client = mocker.MagicMock()
+ rpc_client.get_auth_user_flag_fields = mocker.AsyncMock(return_value=fields)
+ mocker.patch(
+ "backend.util.clients.get_database_manager_async_client",
+ return_value=rpc_client,
+ )
+ user_id = str(uuid.uuid4())
+
+ ctx = await _fetch_user_context_data(user_id)
+
+ assert ctx.get("role") == "authenticated"
+ assert ctx.get("email") == "[email protected]"
+ rpc_client.get_auth_user_flag_fields.assert_called_once_with(user_id)
+ direct.assert_not_called()
class TestUserContextCacheDegradation:
- """A failed Supabase lookup must not poison the 24h context cache.
+ """A failed user lookup must not poison the 24h context cache.
If the degraded anonymous (email-less) context were cached, one
- Supabase blip would make this process evaluate email/role-targeted
+ database blip would make this process evaluate email/role-targeted
flags differently from its peers for a full day, silently.
"""
@staticmethod
- def _stub_failing_supabase(mocker):
- supabase = mocker.MagicMock()
- supabase.auth.admin.get_user_by_id.side_effect = ConnectionError(
- "supabase unreachable"
+ def _stub_failing_lookup(mocker):
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = True
+ return mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(side_effect=ConnectionError("database unreachable")),
)
- mocker.patch("backend.util.clients.get_supabase", return_value=supabase)
- return supabase
@pytest.mark.asyncio
async def test_degraded_anonymous_context_is_not_cached(self, mocker):
- supabase = self._stub_failing_supabase(mocker)
+ accessor = self._stub_failing_lookup(mocker)
user_id = str(uuid.uuid4())
first = await _fetch_user_context_data(user_id)
@@ -236,11 +346,11 @@ class TestUserContextCacheDegradation:
assert first.anonymous is True
assert second.anonymous is True
- assert supabase.auth.admin.get_user_by_id.call_count == 2
+ assert accessor.call_count == 2
@pytest.mark.asyncio
async def test_successful_context_is_cached_across_calls(self, mocker):
- supabase = TestUserContext._stub_supabase(mocker, created_at=None)
+ accessor = TestUserContext._stub_flag_fields(mocker, created_at=None)
user_id = str(uuid.uuid4())
first = await _fetch_user_context_data(user_id)
@@ -248,18 +358,23 @@ class TestUserContextCacheDegradation:
assert first.get("email") == "[email protected]"
assert second.get("email") == "[email protected]"
- assert supabase.auth.admin.get_user_by_id.call_count == 1
+ assert accessor.call_count == 1
@pytest.mark.asyncio
async def test_context_lookup_recovers_after_transient_failure(self, mocker):
- user = mocker.MagicMock(role="authenticated", email="[email protected]", created_at=None)
- response = mocker.MagicMock(user=user)
- supabase = mocker.MagicMock()
- supabase.auth.admin.get_user_by_id.side_effect = [
- ConnectionError("supabase blip"),
- response,
- ]
- mocker.patch("backend.util.clients.get_supabase", return_value=supabase)
+ from backend.data.user import AuthUserFlagFields
+
+ fields = AuthUserFlagFields(
+ role="authenticated", email="[email protected]", created_at=None
+ )
+ mock_prisma = mocker.patch("backend.data.db.prisma")
+ mock_prisma.is_connected.return_value = True
+ mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(
+ side_effect=[ConnectionError("database blip"), fields]
+ ),
+ )
user_id = str(uuid.uuid4())
degraded = await _fetch_user_context_data(user_id)
@@ -272,7 +387,7 @@ class TestUserContextCacheDegradation:
@pytest.mark.asyncio
async def test_degraded_lookup_logs_degradation_warning(self, mocker, caplog):
- self._stub_failing_supabase(mocker)
+ self._stub_failing_lookup(mocker)
user_id = str(uuid.uuid4())
with caplog.at_level(logging.WARNING, logger="backend.util.feature_flag"):
@@ -286,10 +401,13 @@ class TestUserContextCacheDegradation:
assert any(user_id in message and "degraded" in message for message in warnings)
@pytest.mark.asyncio
- async def test_non_uuid_key_skips_supabase_lookup(self, mocker):
- get_supabase = mocker.patch("backend.util.clients.get_supabase")
+ async def test_non_uuid_key_skips_user_lookup(self, mocker):
+ accessor = mocker.patch(
+ "backend.data.user.get_auth_user_flag_fields",
+ new=mocker.AsyncMock(),
+ )
ctx = await _fetch_user_context_data("system")
assert ctx.anonymous is True
- get_supabase.assert_not_called()
+ accessor.assert_not_called()
diff --git a/autogpt_platform/backend/backend/util/settings.py b/autogpt_platform/backend/backend/util/settings.py
index 1b86c5e60a..745e5d1af1 100644
--- a/autogpt_platform/backend/backend/util/settings.py
+++ b/autogpt_platform/backend/backend/util/settings.py
@@ -337,6 +337,16 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
"This value is then used to generate redirect URLs for OAuth flows.",
)
+ trusted_frontend_origins: List[str] = Field(
+ default=[],
+ description="Extra frontend origins (in addition to frontend_base_url) "
+ "that transactional auth-email action links may point at. Entries are "
+ 'full origins ("https://host[:port]") or "regex:"-prefixed patterns, '
+ "same format as backend_cors_allow_origins. Self-hosting needs nothing "
+ "here (frontend_base_url is trusted implicitly); cloud sets a tight "
+ "preview pattern instead of a blanket wildcard.",
+ )
+
platform_link_base_url: str = Field(
default="https://platform.agpt.co/link",
description="Base URL the bot service prepends to one-time linking "
@@ -590,6 +600,28 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
"External apps (like Autopilot) must have their callback URLs start with one of these origins.",
)
+ @field_validator("trusted_frontend_origins")
+ @classmethod
+ def validate_trusted_frontend_origins(cls, v: List[str]) -> List[str]:
+ """Reject unusable entries at startup rather than at send time.
+
+ These patterns are compiled per request in the auth-email route, so a
+ malformed one would otherwise boot fine and then 500 every password
+ reset and verification email.
+ """
+ for raw_origin in v:
+ origin = raw_origin.strip()
+ if not origin.startswith("regex:"):
+ continue
+ pattern = origin[len("regex:") :]
+ if not pattern:
+ raise ValueError("Invalid regex pattern: pattern cannot be empty")
+ try:
+ re.compile(pattern)
+ except re.error as exc:
+ raise ValueError(f"Invalid regex pattern '{pattern}': {exc}") from exc
+ return v
+
@field_validator("backend_cors_allow_origins")
@classmethod
def validate_cors_allow_origins(cls, v: List[str]) -> List[str]:
@@ -662,11 +694,6 @@ class Config(UpdateTrackingModel["Config"], BaseSettings):
class Secrets(UpdateTrackingModel["Secrets"], BaseSettings):
"""Secrets for the server."""
- supabase_url: str = Field(default="", description="Supabase URL")
- supabase_service_role_key: str = Field(
- default="", description="Supabase service role key"
- )
-
encryption_key: str = Field(default="", description="Encryption key")
rabbitmq_default_user: str = Field(default="", description="RabbitMQ default user")
diff --git a/autogpt_platform/backend/migrations/20260610120000_add_better_auth_tables/migration.sql b/autogpt_platform/backend/migrations/20260610120000_add_better_auth_tables/migration.sql
new file mode 100644
index 0000000000..d93bdf6882
--- /dev/null
+++ b/autogpt_platform/backend/migrations/20260610120000_add_better_auth_tables/migration.sql
@@ -0,0 +1,113 @@
+-- Better Auth tables. Owned by Prisma migrations; read/written at runtime by
+-- the Better Auth service embedded in the frontend via its pg adapter.
+
+-- CreateTable
+CREATE TABLE "UserAuthIdentity" (
+ "id" TEXT NOT NULL,
+ "name" TEXT NOT NULL,
+ "email" TEXT NOT NULL,
+ "emailVerified" BOOLEAN NOT NULL DEFAULT false,
+ "image" TEXT,
+ "role" TEXT,
+ "banned" BOOLEAN,
+ "banReason" TEXT,
+ "banExpires" TIMESTAMP(3),
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "UserAuthIdentity_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "UserAuthSession" (
+ "id" TEXT NOT NULL,
+ "expiresAt" TIMESTAMP(3) NOT NULL,
+ "token" TEXT NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "ipAddress" TEXT,
+ "userAgent" TEXT,
+ "impersonatedBy" TEXT,
+ "userId" TEXT NOT NULL,
+
+ CONSTRAINT "UserAuthSession_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "UserAuthAccount" (
+ "id" TEXT NOT NULL,
+ "accountId" TEXT NOT NULL,
+ "providerId" TEXT NOT NULL,
+ "userId" TEXT NOT NULL,
+ "accessToken" TEXT,
+ "refreshToken" TEXT,
+ "idToken" TEXT,
+ "accessTokenExpiresAt" TIMESTAMP(3),
+ "refreshTokenExpiresAt" TIMESTAMP(3),
+ "scope" TEXT,
+ "password" TEXT,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "UserAuthAccount_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "UserAuthVerification" (
+ "id" TEXT NOT NULL,
+ "identifier" TEXT NOT NULL,
+ "value" TEXT NOT NULL,
+ "expiresAt" TIMESTAMP(3) NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+
+ CONSTRAINT "UserAuthVerification_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateTable
+CREATE TABLE "UserAuthJwks" (
+ "id" TEXT NOT NULL,
+ "publicKey" TEXT NOT NULL,
+ "privateKey" TEXT NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "expiresAt" TIMESTAMP(3),
+
+ CONSTRAINT "UserAuthJwks_pkey" PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "UserAuthIdentity_email_key" ON "UserAuthIdentity"("email");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "UserAuthSession_token_key" ON "UserAuthSession"("token");
+
+-- CreateIndex
+CREATE INDEX "UserAuthSession_userId_idx" ON "UserAuthSession"("userId");
+
+-- CreateIndex
+CREATE INDEX "UserAuthAccount_userId_idx" ON "UserAuthAccount"("userId");
+
+-- CreateIndex
+CREATE INDEX "UserAuthVerification_identifier_idx" ON "UserAuthVerification"("identifier");
+
+-- AddForeignKey
+ALTER TABLE "UserAuthSession" ADD CONSTRAINT "UserAuthSession_userId_fkey" FOREIGN KEY ("userId") REFERENCES "UserAuthIdentity"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- AddForeignKey
+ALTER TABLE "UserAuthAccount" ADD CONSTRAINT "UserAuthAccount_userId_fkey" FOREIGN KEY ("userId") REFERENCES "UserAuthIdentity"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+
+-- Remove the legacy Supabase GoTrue -> platform sync trigger. Platform User
+-- rows are created by get_or_create_user on first authenticated request, and
+-- new signups land in the Better Auth "UserAuthIdentity" table instead of auth.users.
+DO $$
+BEGIN
+ IF EXISTS (
+ SELECT 1
+ FROM information_schema.tables
+ WHERE table_schema = 'auth'
+ AND table_name = 'users'
+ ) THEN
+ DROP TRIGGER IF EXISTS user_added_to_platform ON auth.users;
+ END IF;
+ DROP FUNCTION IF EXISTS add_user_and_profile_to_platform();
+END $$;
diff --git a/autogpt_platform/backend/migrations/20260716110000_add_user_preferred_name/migration.sql b/autogpt_platform/backend/migrations/20260716110000_add_user_preferred_name/migration.sql
new file mode 100644
index 0000000000..b711d73cca
--- /dev/null
+++ b/autogpt_platform/backend/migrations/20260716110000_add_user_preferred_name/migration.sql
@@ -0,0 +1,5 @@
+-- Better Auth additional field backing the onboarding "What should I call
+-- you?" answer (user_metadata.preferred_name in the GoTrue world). Must run
+-- before 20260716120000_copy_supabase_users_to_better_auth, which copies the
+-- GoTrue metadata value into it.
+ALTER TABLE "UserAuthIdentity" ADD COLUMN "preferredName" TEXT;
diff --git a/autogpt_platform/backend/migrations/20260716120000_copy_supabase_users_to_better_auth/migration.sql b/autogpt_platform/backend/migrations/20260716120000_copy_supabase_users_to_better_auth/migration.sql
new file mode 100644
index 0000000000..c885b72757
--- /dev/null
+++ b/autogpt_platform/backend/migrations/20260716120000_copy_supabase_users_to_better_auth/migration.sql
@@ -0,0 +1,158 @@
+-- One-time copy of Supabase GoTrue users into the Better Auth tables:
+-- auth.users -> "UserAuthIdentity"
+-- email/password credentials -> "UserAuthAccount" (providerId = 'credential';
+-- bcrypt hashes carry over because Better
+-- Auth is configured to verify with bcrypt)
+-- auth.identities -> "UserAuthAccount" (google / github / discord)
+--
+-- Runs in the normal `prisma migrate deploy` pipeline step, which the deploy
+-- workflows order before any pod rollout. All data movement is server-side
+-- INSERT..SELECT, so the statement count is tiny and the runner's network
+-- location is irrelevant.
+--
+-- On databases without a Supabase auth schema (fresh installs, CI, local
+-- dev) the guard makes this a no-op. Every insert is also individually
+-- guarded (ON CONFLICT / NOT EXISTS) so the migration is safe on databases
+-- where some users were already copied — e.g. preview environments where
+-- scripts/migrate-supabase-auth.ts ran manually. That same script remains
+-- the post-cutover straggler sweep for users who sign up via GoTrue between
+-- this migration running and the frontend switching to Better Auth.
+
+DO $$
+DECLARE
+ users_copied bigint := 0;
+ credential_accounts_copied bigint := 0;
+ oauth_accounts_copied bigint := 0;
+BEGIN
+ IF to_regclass('auth.users') IS NULL THEN
+ RAISE NOTICE 'auth.users does not exist - nothing to migrate';
+ RETURN;
+ END IF;
+
+ -- 1) auth.users -> "UserAuthIdentity". Skip deleted users and rows without an email.
+ -- The NOT EXISTS email guard skips users whose email is already taken
+ -- by a different Better Auth user instead of failing the whole
+ -- migration on the unique(email) index.
+ --
+ -- DISTINCT ON (u.email) de-dups WITHIN this batch: two GoTrue rows can
+ -- share an email (e.g. an SSO identity + a password identity — GoTrue's
+ -- partial unique index permits it). Without it, both rows pass the
+ -- NOT EXISTS guard (neither is in "UserAuthIdentity" yet) and the second insert trips
+ -- UserAuthIdentity_email_key, aborting the ENTIRE INSERT and failing the deploy. The
+ -- ORDER BY makes the surviving row deterministic: prefer a confirmed
+ -- account, then the oldest. The dropped duplicate's credential/oauth rows
+ -- are naturally skipped below by the "id must exist in UserAuthIdentity" guards.
+ INSERT INTO "UserAuthIdentity"
+ (id, name, email, "emailVerified", role, banned, "preferredName",
+ "createdAt", "updatedAt")
+ SELECT DISTINCT ON (u.email)
+ u.id::text,
+ COALESCE(
+ u.raw_user_meta_data->>'name',
+ u.raw_user_meta_data->>'full_name',
+ split_part(u.email, '@', 1)
+ ),
+ u.email,
+ (u.email_confirmed_at IS NOT NULL),
+ CASE
+ WHEN COALESCE(u.is_super_admin, false) OR u.role = 'admin'
+ THEN 'admin' ELSE 'user'
+ END,
+ (u.banned_until IS NOT NULL AND u.banned_until > now()),
+ u.raw_user_meta_data->>'preferred_name',
+ COALESCE(u.created_at, now()),
+ COALESCE(u.updated_at, now())
+ FROM auth.users u
+ WHERE u.email IS NOT NULL
+ AND u.deleted_at IS NULL
+ AND NOT EXISTS (
+ SELECT 1 FROM "UserAuthIdentity" pu
+ WHERE pu.email = u.email AND pu.id <> u.id::text
+ )
+ ORDER BY
+ u.email,
+ (u.email_confirmed_at IS NOT NULL) DESC,
+ COALESCE(u.created_at, now()) ASC
+ ON CONFLICT (id) DO NOTHING;
+ GET DIAGNOSTICS users_copied = ROW_COUNT;
+
+ -- 2) Email/password credentials -> "UserAuthAccount".
+ INSERT INTO "UserAuthAccount"
+ (id, "accountId", "providerId", "userId", password, "createdAt", "updatedAt")
+ SELECT
+ gen_random_uuid()::text,
+ u.id::text,
+ 'credential',
+ u.id::text,
+ u.encrypted_password,
+ COALESCE(u.created_at, now()),
+ COALESCE(u.updated_at, now())
+ FROM auth.users u
+ WHERE u.encrypted_password IS NOT NULL
+ AND length(u.encrypted_password) > 0
+ AND EXISTS (
+ SELECT 1 FROM "UserAuthIdentity" pu WHERE pu.id = u.id::text
+ )
+ AND NOT EXISTS (
+ SELECT 1 FROM "UserAuthAccount" a
+ WHERE a."userId" = u.id::text AND a."providerId" = 'credential'
+ );
+ GET DIAGNOSTICS credential_accounts_copied = ROW_COUNT;
+
+ -- 3) OAuth identities -> account. Provider 'email' is the GoTrue-internal
+ -- credential identity and is skipped (handled above); only providers
+ -- Better Auth is configured for migrate. GoTrue added
+ -- identities.provider_id (the provider's user id) in newer versions;
+ -- older schemas only carry it inside identity_data->>'sub'. The branch
+ -- referencing provider_id only resolves when that column exists.
+ IF to_regclass('auth.identities') IS NOT NULL THEN
+ IF EXISTS (
+ SELECT 1 FROM information_schema.columns
+ WHERE table_schema = 'auth'
+ AND table_name = 'identities'
+ AND column_name = 'provider_id'
+ ) THEN
+ INSERT INTO "UserAuthAccount"
+ (id, "accountId", "providerId", "userId", "createdAt", "updatedAt")
+ SELECT
+ gen_random_uuid()::text,
+ COALESCE(i.provider_id::text, i.identity_data->>'sub', i.user_id::text),
+ i.provider,
+ i.user_id::text,
+ COALESCE(i.created_at, now()),
+ COALESCE(i.updated_at, now())
+ FROM auth.identities i
+ WHERE i.provider IN ('google', 'github', 'discord')
+ AND EXISTS (
+ SELECT 1 FROM "UserAuthIdentity" pu WHERE pu.id = i.user_id::text
+ )
+ AND NOT EXISTS (
+ SELECT 1 FROM "UserAuthAccount" a
+ WHERE a."userId" = i.user_id::text AND a."providerId" = i.provider
+ );
+ ELSE
+ INSERT INTO "UserAuthAccount"
+ (id, "accountId", "providerId", "userId", "createdAt", "updatedAt")
+ SELECT
+ gen_random_uuid()::text,
+ COALESCE(i.identity_data->>'sub', i.user_id::text),
+ i.provider,
+ i.user_id::text,
+ COALESCE(i.created_at, now()),
+ COALESCE(i.updated_at, now())
+ FROM auth.identities i
+ WHERE i.provider IN ('google', 'github', 'discord')
+ AND EXISTS (
+ SELECT 1 FROM "UserAuthIdentity" pu WHERE pu.id = i.user_id::text
+ )
+ AND NOT EXISTS (
+ SELECT 1 FROM "UserAuthAccount" a
+ WHERE a."userId" = i.user_id::text AND a."providerId" = i.provider
+ );
+ END IF;
+ GET DIAGNOSTICS oauth_accounts_copied = ROW_COUNT;
+ END IF;
+
+ RAISE NOTICE 'supabase -> better auth copy: % users, % credential accounts, % oauth accounts',
+ users_copied, credential_accounts_copied, oauth_accounts_copied;
+END $$;
diff --git a/autogpt_platform/backend/poetry.lock b/autogpt_platform/backend/poetry.lock
index af3f13f81d..81fef0640b 100644
--- a/autogpt_platform/backend/poetry.lock
+++ b/autogpt_platform/backend/poetry.lock
@@ -462,13 +462,10 @@ cryptography = "^46.0"
expiringdict = "^1.2.2"
fastapi = "^0.128.7"
google-cloud-logging = "^3.13.0"
-launchdarkly-server-sdk = "^9.15.0"
pydantic = "^2.12.5"
pydantic-settings = "^2.12.0"
pyjwt = {version = "^2.11.0", extras = ["crypto"]}
redis = "^6.2.0"
-supabase = "^2.28.0"
-uvicorn = "^0.40.0"
[package.source]
type = "directory"
@@ -516,6 +513,83 @@ files = [
docs = ["furo", "jaraco.packaging (>=9.3)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
testing = ["jaraco.test", "pytest (!=8.0.*)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)"]
+[[package]]
+name = "bcrypt"
+version = "5.0.0"
+description = "Modern password hashing for your software and your servers"
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "bcrypt-5.0.0-cp313-cp313t-macosx_10_12_universal2.whl", hash = "sha256:f3c08197f3039bec79cee59a606d62b96b16669cff3949f21e74796b6e3cd2be"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:200af71bc25f22006f4069060c88ed36f8aa4ff7f53e67ff04d2ab3f1e79a5b2"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:baade0a5657654c2984468efb7d6c110db87ea63ef5a4b54732e7e337253e44f"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:c58b56cdfb03202b3bcc9fd8daee8e8e9b6d7e3163aa97c631dfcfcc24d36c86"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4bfd2a34de661f34d0bda43c3e4e79df586e4716ef401fe31ea39d69d581ef23"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:ed2e1365e31fc73f1825fa830f1c8f8917ca1b3ca6185773b349c20fd606cec2"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux_2_34_aarch64.whl", hash = "sha256:83e787d7a84dbbfba6f250dd7a5efd689e935f03dd83b0f919d39349e1f23f83"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-manylinux_2_34_x86_64.whl", hash = "sha256:137c5156524328a24b9fac1cb5db0ba618bc97d11970b39184c1d87dc4bf1746"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:38cac74101777a6a7d3b3e3cfefa57089b5ada650dce2baf0cbdd9d65db22a9e"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:d8d65b564ec849643d9f7ea05c6d9f0cd7ca23bdd4ac0c2dbef1104ab504543d"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:741449132f64b3524e95cd30e5cd3343006ce146088f074f31ab26b94e6c75ba"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:212139484ab3207b1f0c00633d3be92fef3c5f0af17cad155679d03ff2ee1e41"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-win32.whl", hash = "sha256:9d52ed507c2488eddd6a95bccee4e808d3234fa78dd370e24bac65a21212b861"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f6984a24db30548fd39a44360532898c33528b74aedf81c26cf29c51ee47057e"},
+ {file = "bcrypt-5.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:9fffdb387abe6aa775af36ef16f55e318dcda4194ddbf82007a6f21da29de8f5"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-macosx_10_12_universal2.whl", hash = "sha256:4870a52610537037adb382444fefd3706d96d663ac44cbb2f37e3919dca3d7ef"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:48f753100931605686f74e27a7b49238122aa761a9aefe9373265b8b7aa43ea4"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f70aadb7a809305226daedf75d90379c397b094755a710d7014b8b117df1ebbf"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:744d3c6b164caa658adcb72cb8cc9ad9b4b75c7db507ab4bc2480474a51989da"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a28bc05039bdf3289d757f49d616ab3efe8cf40d8e8001ccdd621cd4f98f4fc9"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:7f277a4b3390ab4bebe597800a90da0edae882c6196d3038a73adf446c4f969f"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:79cfa161eda8d2ddf29acad370356b47f02387153b11d46042e93a0a95127493"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:a5393eae5722bcef046a990b84dff02b954904c36a194f6cfc817d7dca6c6f0b"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7f4c94dec1b5ab5d522750cb059bb9409ea8872d4494fd152b53cca99f1ddd8c"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0cae4cb350934dfd74c020525eeae0a5f79257e8a201c0c176f4b84fdbf2a4b4"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-win32.whl", hash = "sha256:b17366316c654e1ad0306a6858e189fc835eca39f7eb2cafd6aaca8ce0c40a2e"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:92864f54fb48b4c718fc92a32825d0e42265a627f956bc0361fe869f1adc3e7d"},
+ {file = "bcrypt-5.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:dd19cf5184a90c873009244586396a6a884d591a5323f0e8a5922560718d4993"},
+ {file = "bcrypt-5.0.0-cp38-abi3-macosx_10_12_universal2.whl", hash = "sha256:fc746432b951e92b58317af8e0ca746efe93e66555f1b40888865ef5bf56446b"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c2388ca94ffee269b6038d48747f4ce8df0ffbea43f31abfa18ac72f0218effb"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:560ddb6ec730386e7b3b26b8b4c88197aaed924430e7b74666a586ac997249ef"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d79e5c65dcc9af213594d6f7f1fa2c98ad3fc10431e7aa53c176b441943efbdd"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2b732e7d388fa22d48920baa267ba5d97cca38070b69c0e2d37087b381c681fd"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:0c8e093ea2532601a6f686edbc2c6b2ec24131ff5c52f7610dd64fa4553b5464"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:5b1589f4839a0899c146e8892efe320c0fa096568abd9b95593efac50a87cb75"},
+ {file = "bcrypt-5.0.0-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:89042e61b5e808b67daf24a434d89bab164d4de1746b37a8d173b6b14f3db9ff"},
+ {file = "bcrypt-5.0.0-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:e3cf5b2560c7b5a142286f69bde914494b6d8f901aaa71e453078388a50881c4"},
+ {file = "bcrypt-5.0.0-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:f632fd56fc4e61564f78b46a2269153122db34988e78b6be8b32d28507b7eaeb"},
+ {file = "bcrypt-5.0.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:801cad5ccb6b87d1b430f183269b94c24f248dddbbc5c1f78b6ed231743e001c"},
+ {file = "bcrypt-5.0.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3cf67a804fc66fc217e6914a5635000259fbbbb12e78a99488e4d5ba445a71eb"},
+ {file = "bcrypt-5.0.0-cp38-abi3-win32.whl", hash = "sha256:3abeb543874b2c0524ff40c57a4e14e5d3a66ff33fb423529c88f180fd756538"},
+ {file = "bcrypt-5.0.0-cp38-abi3-win_amd64.whl", hash = "sha256:35a77ec55b541e5e583eb3436ffbbf53b0ffa1fa16ca6782279daf95d146dcd9"},
+ {file = "bcrypt-5.0.0-cp38-abi3-win_arm64.whl", hash = "sha256:cde08734f12c6a4e28dc6755cd11d3bdfea608d93d958fffbe95a7026ebe4980"},
+ {file = "bcrypt-5.0.0-cp39-abi3-macosx_10_12_universal2.whl", hash = "sha256:0c418ca99fd47e9c59a301744d63328f17798b5947b0f791e9af3c1c499c2d0a"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ddb4e1500f6efdd402218ffe34d040a1196c072e07929b9820f363a1fd1f4191"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7aeef54b60ceddb6f30ee3db090351ecf0d40ec6e2abf41430997407a46d2254"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f0ce778135f60799d89c9693b9b398819d15f1921ba15fe719acb3178215a7db"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a71f70ee269671460b37a449f5ff26982a6f2ba493b3eabdd687b4bf35f875ac"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f8429e1c410b4073944f03bd778a9e066e7fad723564a52ff91841d278dfc822"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:edfcdcedd0d0f05850c52ba3127b1fce70b9f89e0fe5ff16517df7e81fa3cbb8"},
+ {file = "bcrypt-5.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:611f0a17aa4a25a69362dcc299fda5c8a3d4f160e2abb3831041feb77393a14a"},
+ {file = "bcrypt-5.0.0-cp39-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:db99dca3b1fdc3db87d7c57eac0c82281242d1eabf19dcb8a6b10eb29a2e72d1"},
+ {file = "bcrypt-5.0.0-cp39-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:5feebf85a9cefda32966d8171f5db7e3ba964b77fdfe31919622256f80f9cf42"},
+ {file = "bcrypt-5.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:3ca8a166b1140436e058298a34d88032ab62f15aae1c598580333dc21d27ef10"},
+ {file = "bcrypt-5.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:61afc381250c3182d9078551e3ac3a41da14154fbff647ddf52a769f588c4172"},
+ {file = "bcrypt-5.0.0-cp39-abi3-win32.whl", hash = "sha256:64d7ce196203e468c457c37ec22390f1a61c85c6f0b8160fd752940ccfb3a683"},
+ {file = "bcrypt-5.0.0-cp39-abi3-win_amd64.whl", hash = "sha256:64ee8434b0da054d830fa8e89e1c8bf30061d539044a39524ff7dec90481e5c2"},
+ {file = "bcrypt-5.0.0-cp39-abi3-win_arm64.whl", hash = "sha256:f2347d3534e76bf50bca5500989d6c1d05ed64b440408057a37673282c654927"},
+ {file = "bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:7edda91d5ab52b15636d9c30da87d2cc84f426c72b9dba7a9b4fe142ba11f534"},
+ {file = "bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:046ad6db88edb3c5ece4369af997938fb1c19d6a699b9c1b27b0db432faae4c4"},
+ {file = "bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:dcd58e2b3a908b5ecc9b9df2f0085592506ac2d5110786018ee5e160f28e0911"},
+ {file = "bcrypt-5.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:6b8f520b61e8781efee73cba14e3e8c9556ccfb375623f4f97429544734545b4"},
+ {file = "bcrypt-5.0.0.tar.gz", hash = "sha256:f748f7c2d6fd375cc93d3fba7ef4a9e3a092421b8dbf34d8d4dc06be9492dfdd"},
+]
+
+[package.extras]
+tests = ["pytest (>=3.2.1,!=3.3.0)"]
+typecheck = ["mypy"]
+
[[package]]
name = "black"
version = "24.10.0"
@@ -1224,21 +1298,6 @@ files = [
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
]
-[[package]]
-name = "deprecation"
-version = "2.1.0"
-description = "A library to handle automated deprecations"
-optional = false
-python-versions = "*"
-groups = ["main"]
-files = [
- {file = "deprecation-2.1.0-py2.py3-none-any.whl", hash = "sha256:a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a"},
- {file = "deprecation-2.1.0.tar.gz", hash = "sha256:72b3bde64e5d778694b0cf68178aed03d15e15477116add3fb773e581f9518ff"},
-]
-
-[package.dependencies]
-packaging = "*"
-
[[package]]
name = "discord-py"
version = "2.6.4"
@@ -4750,25 +4809,6 @@ docs = ["portalocker[tests]"]
redis = ["redis"]
tests = ["coverage-conditional-plugin (>=0.9.0)", "portalocker[redis]", "pytest (>=5.4.1)", "pytest-cov (>=2.8.1)", "pytest-mypy (>=0.8.0)", "pytest-rerunfailures (>=15.0)", "pytest-timeout (>=2.1.0)", "sphinx (>=6.0.0)", "types-pywin32 (>=310.0.0.20250429)", "types-redis"]
-[[package]]
-name = "postgrest"
-version = "2.31.0"
-description = "PostgREST client for Python. This library provides an ORM interface to PostgREST."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "postgrest-2.31.0-py3-none-any.whl", hash = "sha256:c2fd47c94e13ee8335111c4f03c9a24ea9766ce9d35fc3cd7330057c9e7ea0c3"},
- {file = "postgrest-2.31.0.tar.gz", hash = "sha256:2f395d84b2ee34fc57622ff2f711df603e2ede625f98e5015240741888f7bd0c"},
-]
-
-[package.dependencies]
-deprecation = ">=2.1.0"
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=1.9,<3.0"
-strenum = {version = ">=0.4.9", markers = "python_full_version < \"3.11.0\""}
-yarl = ">=1.20.1"
-
[[package]]
name = "posthog"
version = "7.19.2"
@@ -6317,23 +6357,6 @@ files = [
[package.extras]
all = ["numpy"]
-[[package]]
-name = "realtime"
-version = "2.31.0"
-description = ""
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "realtime-2.31.0-py3-none-any.whl", hash = "sha256:f6e494b53d6a6e80b6efcee6711c8dd40413a52e766271de1bce8ced6c36cc1d"},
- {file = "realtime-2.31.0.tar.gz", hash = "sha256:9e641cb4d77ca0fe768515f8cf9f83550c79f49ce1550a95afc2dc0e252be8c9"},
-]
-
-[package.dependencies]
-pydantic = ">=2.11.7,<3.0.0"
-typing-extensions = ">=4.14.0"
-websockets = ">=11,<16"
-
[[package]]
name = "redis"
version = "6.4.0"
@@ -7119,27 +7142,6 @@ typing-extensions = {version = ">=4.10.0", markers = "python_version < \"3.13\""
[package.extras]
full = ["httpx (>=0.27.0,<0.29.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.18)", "pyyaml"]
-[[package]]
-name = "storage3"
-version = "2.31.0"
-description = "Supabase Storage client for Python."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "storage3-2.31.0-py3-none-any.whl", hash = "sha256:4bf46e8bea320743179a6beafdc7531c5242495e00e0cc22af7c7a9d69d4ed84"},
- {file = "storage3-2.31.0.tar.gz", hash = "sha256:d2161e2ea650dc115a1787c30e09b118365589ac772f4dd8643e3a503ecfc667"},
-]
-
-[package.dependencies]
-deprecation = ">=2.1.0"
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=2.11.7"
-yarl = ">=1.20.1"
-
-[package.extras]
-iceberg = ["pyiceberg (>=0.10.0)"]
-
[[package]]
name = "strenum"
version = "0.4.15"
@@ -7173,64 +7175,6 @@ files = [
requests = {version = ">=2.20", markers = "python_version >= \"3.0\""}
typing-extensions = {version = ">=4.5.0", markers = "python_version >= \"3.7\""}
-[[package]]
-name = "supabase"
-version = "2.31.0"
-description = "Supabase client for Python."
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase-2.31.0-py3-none-any.whl", hash = "sha256:25f2a99207a75f2d9377e2332783b4389cf56b02cbebdaf0c1743112dcbb704e"},
- {file = "supabase-2.31.0.tar.gz", hash = "sha256:3467b09d00482b9a0138235bdbde7a350426f93cf2a1342372eaddfc669f1206"},
-]
-
-[package.dependencies]
-httpx = ">=0.26,<0.29"
-postgrest = "2.31.0"
-realtime = "2.31.0"
-storage3 = "2.31.0"
-supabase-auth = "2.31.0"
-supabase-functions = "2.31.0"
-yarl = ">=1.22.0"
-
-[package.extras]
-iceberg = ["storage3[iceberg] (==2.31.0)"]
-
-[[package]]
-name = "supabase-auth"
-version = "2.31.0"
-description = "Python Client Library for Supabase Auth"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase_auth-2.31.0-py3-none-any.whl", hash = "sha256:5e9c8b4ecdee6af04dbcb06455ce78cb15674806fcb6b425170455307d70b0ee"},
- {file = "supabase_auth-2.31.0.tar.gz", hash = "sha256:0945b33fa96239c76dc8eaf96d7d2c94991950d24b4cfe4a5c2da9aa5e909663"},
-]
-
-[package.dependencies]
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-pydantic = ">=1.10,<3"
-pyjwt = {version = ">=2.12.0", extras = ["crypto"]}
-
-[[package]]
-name = "supabase-functions"
-version = "2.31.0"
-description = "Library for Supabase Functions"
-optional = false
-python-versions = ">=3.9"
-groups = ["main"]
-files = [
- {file = "supabase_functions-2.31.0-py3-none-any.whl", hash = "sha256:3fdc4c4766152bfda63bdd0e286fc8a06f50e1280711fae4a1dfc9b7e9ebabc6"},
- {file = "supabase_functions-2.31.0.tar.gz", hash = "sha256:4ad027b3ae3bd28b31233339f4db1da6965affd3546f655b421baf40cee2690f"},
-]
-
-[package.dependencies]
-httpx = {version = ">=0.26,<0.29", extras = ["http2"]}
-strenum = ">=0.4.15"
-yarl = ">=1.20.1"
-
[[package]]
name = "tenacity"
version = "9.1.4"
@@ -8663,4 +8607,4 @@ cffi = ["cffi (>=1.17,<2.0) ; platform_python_implementation != \"PyPy\" and pyt
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<3.14"
-content-hash = "16987f8436cb1534eda5c73bb992e07d20b436afabcf3e8da830ef1d4117b423"
+content-hash = "c3a3271f197bce923c6d52e7e1c7f5c6939470dc9f14e9221a60a2c224e8ee70"
diff --git a/autogpt_platform/backend/pyproject.toml b/autogpt_platform/backend/pyproject.toml
index 2a5a0b40f7..3e6f0e41f3 100644
--- a/autogpt_platform/backend/pyproject.toml
+++ b/autogpt_platform/backend/pyproject.toml
@@ -16,6 +16,7 @@ agentmail = "^0.4.5"
anthropic = "^0.79.0"
apscheduler = "^3.11.1"
autogpt-libs = { path = "../autogpt_libs", develop = true }
+bcrypt = "^5.0.0"
bleach = { extras = ["css"], version = "^6.2.0" }
cachetools = "^5.5.0"
claude-agent-sdk = "^0.1.64" # bundled CLI 2.1.116 -- 2.1.98+ fixes the --resume + excludeDynamicSections crash that used to force a per-turn 33K cache write. CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 env var strips the broken context-management beta. See sdk_compat_test.py.
@@ -73,7 +74,6 @@ slack-sdk = "^3.41.0"
sqlalchemy = "^2.0.40"
strenum = "^0.4.9"
stripe = "^11.5.0"
-supabase = "^2.31.0"
tenacity = "^9.1.4"
todoist-api-python = "^2.1.7"
tweepy = "^4.16.0"
diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prisma
index 00cd6299e5..0f67c97ce1 100644
--- a/autogpt_platform/backend/schema.prisma
+++ b/autogpt_platform/backend/schema.prisma
@@ -13,6 +13,91 @@ generator client {
partial_type_generator = "backend/data/partial_types.py"
}
+// ============ Auth service (Better Auth) tables ============ //
+// Owned by Prisma migrations, but read/written at runtime by the Better Auth
+// service embedded in the frontend (via its pg adapter). Table and column
+// names must match Better Auth's expected model/field names exactly.
+
+model AuthUser {
+ id String @id
+ name String
+ email String @unique
+ emailVerified Boolean @default(false)
+ image String?
+ role String?
+ banned Boolean?
+ banReason String?
+ banExpires DateTime?
+ preferredName String?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+
+ sessions AuthSession[]
+ accounts AuthAccount[]
+
+ @@map("UserAuthIdentity")
+}
+
+model AuthSession {
+ id String @id
+ expiresAt DateTime
+ token String @unique
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+ ipAddress String?
+ userAgent String?
+ impersonatedBy String?
+ userId String
+ user AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
+
+ @@index([userId])
+ @@map("UserAuthSession")
+}
+
+model AuthAccount {
+ id String @id
+ accountId String
+ providerId String
+ userId String
+ accessToken String?
+ refreshToken String?
+ idToken String?
+ accessTokenExpiresAt DateTime?
+ refreshTokenExpiresAt DateTime?
+ scope String?
+ password String?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+ user AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
+
+ @@index([userId])
+ @@map("UserAuthAccount")
+}
+
+model AuthVerification {
+ id String @id
+ identifier String
+ value String
+ expiresAt DateTime
+ createdAt DateTime @default(now())
+ updatedAt DateTime @default(now()) @updatedAt
+
+ @@index([identifier])
+ @@map("UserAuthVerification")
+}
+
+model AuthJwks {
+ id String @id
+ publicKey String
+ privateKey String
+ createdAt DateTime @default(now())
+ expiresAt DateTime?
+
+ @@map("UserAuthJwks")
+}
+
+// ============ End auth service (Better Auth) tables ============ //
+
// User model to mirror Auth provider users
model User {
id String @id // This should match the Supabase user ID
diff --git a/autogpt_platform/backend/test/e2e_test_data.py b/autogpt_platform/backend/test/e2e_test_data.py
index 7142da2c6f..f698fd296e 100644
--- a/autogpt_platform/backend/test/e2e_test_data.py
+++ b/autogpt_platform/backend/test/e2e_test_data.py
@@ -19,6 +19,7 @@ import uuid
from pathlib import Path
from typing import Any, Dict, List
+import bcrypt
import prisma.enums as prisma_enums
import prisma.models as prisma_models
from faker import Faker
@@ -39,7 +40,6 @@ from backend.data.db import prisma
from backend.data.graph import Graph, Link, Node, create_graph, make_graph_model
from backend.data.model import APIKeyCredentials
from backend.data.user import get_or_create_user
-from backend.util.clients import get_supabase
from backend.util.encryption import JSONCryptor
from backend.util.json import SafeJson
@@ -181,11 +181,12 @@ class TestDataCreator:
print(f"Bootstrapped personal orgs for {created} seeded user(s)")
async def create_test_users(self) -> List[Dict[str, Any]]:
- """Create test users using Supabase client."""
+ """Create test users with login-able Better Auth credential accounts."""
print(f"Creating {NUM_USERS} test users...")
- supabase = get_supabase()
users = []
+ password = "testpassword123" # Standard test password # pragma: allowlist secret # noqa
+ password_hash = bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
for i in range(NUM_USERS):
try:
@@ -195,21 +196,8 @@ class TestDataCreator:
email = SEEDED_TEST_EMAILS[i]
else:
email = faker.unique.email()
- password = "testpassword123" # Standard test password # pragma: allowlist secret # noqa
- user_id = f"test-user-{i}-{faker.uuid4()}"
- # Create user in Supabase Auth (if needed)
- try:
- auth_response = supabase.auth.admin.create_user(
- {"email": email, "password": password, "email_confirm": True}
- )
- if auth_response.user:
- user_id = auth_response.user.id
- except Exception as supabase_error:
- print(
- f"Supabase user creation failed for {email}, using fallback: {supabase_error}"
- )
- # Fall back to direct database creation
+ user_id = await self._ensure_auth_user(email, password_hash)
# Create mock user data similar to what auth middleware would provide
user_data = {
@@ -228,6 +216,33 @@ class TestDataCreator:
self.users = users
return users
+ @staticmethod
+ async def _ensure_auth_user(email: str, password_hash: str) -> str:
+ """Create (or reuse) a Better Auth user + credential account, return its id."""
+ existing = await prisma.authuser.find_unique(where={"email": email})
+ if existing:
+ return existing.id
+
+ user_id = str(faker.uuid4())
+ await prisma.authuser.create(
+ data={
+ "id": user_id,
+ "name": email.split("@")[0],
+ "email": email,
+ "emailVerified": True,
+ }
+ )
+ await prisma.authaccount.create(
+ data={
+ "id": str(faker.uuid4()),
+ "accountId": user_id,
+ "providerId": "credential",
+ "userId": user_id,
+ "password": password_hash,
+ }
+ )
+ return user_id
+
async def get_available_blocks(self) -> List[Dict[str, Any]]:
"""Get available agent blocks from database."""
print("Getting available agent blocks...")
diff --git a/autogpt_platform/db/init/00-init.sql b/autogpt_platform/db/init/00-init.sql
new file mode 100644
index 0000000000..6d2c3ed480
--- /dev/null
+++ b/autogpt_platform/db/init/00-init.sql
@@ -0,0 +1,44 @@
+-- Initializes a fresh local Postgres for the AutoGPT platform.
+-- Runs once via /docker-entrypoint-initdb.d/ when the data volume is empty.
+--
+-- Auth is handled by Better Auth (embedded in the Next.js frontend); its
+-- tables live in the `platform` schema and are created by the backend's
+-- Prisma migrations. Nothing Supabase-related runs in this stack anymore.
+
+-- Schema used by Prisma (DATABASE_URL ?schema=platform) and Better Auth.
+CREATE SCHEMA IF NOT EXISTS platform;
+
+-- Legacy `auth` schema shim.
+--
+-- Historical Prisma migrations reference auth.users (triggers, backfills):
+-- 20241007175112_add_oauth_creds_user_trigger
+-- 20250205100104_add_profile_trigger
+-- 20260311000000_drop_auto_user_trigger
+-- 20260319120000_revert_invite_system
+-- 20260610120000_add_better_auth_tables
+-- All of them guard on the table's existence, but the revert_invite_system
+-- backfill and the trigger re-creation SELECT real columns from auth.users.
+-- This empty shim lets the full migration history apply cleanly on a fresh
+-- database. It is never written to at runtime.
+CREATE SCHEMA IF NOT EXISTS auth;
+
+CREATE TABLE IF NOT EXISTS auth.users (
+ id uuid PRIMARY KEY,
+ email text,
+ encrypted_password text,
+ raw_user_meta_data jsonb DEFAULT '{}',
+ raw_app_meta_data jsonb DEFAULT '{}',
+ role text,
+ is_super_admin boolean,
+ created_at timestamptz DEFAULT now(),
+ updated_at timestamptz DEFAULT now(),
+ deleted_at timestamptz,
+ email_confirmed_at timestamptz,
+ phone text,
+ banned_until timestamptz
+);
+
+-- No other Supabase objects (supabase_functions, realtime, storage, pgsodium,
+-- vault, ...) are referenced by the migration history. The pgvector and
+-- pg_trgm extensions are created by the migrations themselves and ship with
+-- the pgvector/pgvector image.
diff --git a/autogpt_platform/docker-compose.platform.yml b/autogpt_platform/docker-compose.platform.yml
index 7da975c17d..39afa0fa1a 100644
--- a/autogpt_platform/docker-compose.platform.yml
+++ b/autogpt_platform/docker-compose.platform.yml
@@ -27,8 +27,11 @@ x-backend-env:
RABBITMQ_HOST: rabbitmq
GRAPHITI_FALKORDB_HOST: falkordb
GRAPHITI_FALKORDB_PORT: "6379"
- # Override Supabase URL for Docker network
- SUPABASE_URL: http://kong:8000
+ # JWKS endpoint of the Better Auth service embedded in the frontend.
+ # Containers reach it via the compose service name, not localhost.
+ # JWT_VERIFY_KEY (legacy HS256, from backend/.env.default) stays in place
+ # for the migration window while old Supabase-issued tokens circulate.
+ JWT_JWKS_URL: http://frontend:3000/api/auth/jwks
# Database connection string for Docker network
# This cannot be constructed like in .env because we cannot interpolate values set here (DB_HOST)
DATABASE_URL: postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres?connect_timeout=60&schema=platform
@@ -479,10 +482,12 @@ services:
environment:
# Server-side environment variables (Docker service names)
# These override the localhost URLs from env files when running in Docker
- AUTH_CALLBACK_URL: http://rest_server:8006/auth/callback
- SUPABASE_URL: http://kong:8000
AGPT_SERVER_URL: http://rest_server:8006/api
AGPT_WS_SERVER_URL: ws://websocket_server:8001/ws
+ # Better Auth (embedded in this Next.js server) — talks to Postgres
+ # directly; tables live in the platform schema (Prisma migrations).
+ DATABASE_URL: postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres
+ AUTH_DB_SCHEMA: platform
volumes:
workspace-data:
falkordb_data:
diff --git a/autogpt_platform/docker-compose.yml b/autogpt_platform/docker-compose.yml
index 5fb81674b4..48d2baa80d 100644
--- a/autogpt_platform/docker-compose.yml
+++ b/autogpt_platform/docker-compose.yml
@@ -5,7 +5,6 @@ networks:
name: shared-network
volumes:
- supabase-config:
clamav-data:
workspace-data:
falkordb_data:
@@ -16,12 +15,6 @@ x-agpt-services:
- app-network
- shared-network
-x-supabase-services:
- &supabase-services
- networks:
- - app-network
- - shared-network
-
services:
# AGPT services
@@ -143,70 +136,45 @@ services:
file: ./docker-compose.platform.yml
service: frontend
- # Supabase services (minimal: auth + db + kong)
- kong:
- <<: *supabase-services
- extends:
- file: ./db/docker/docker-compose.yml
- service: kong
-
- auth:
- <<: *supabase-services
- extends:
- file: ./db/docker/docker-compose.yml
- service: auth
- environment:
- GOTRUE_MAILER_AUTOCONFIRM: true
-
# db waits on rabbitmq:service_healthy to gate startup ordering:
# concurrent container creation in E2B's Docker races RabbitMQ's
- # .erlang.cookie write, producing `eacces` at broker boot. Supabase's
- # auth/meta/studio + migrate all depends_on db:service_healthy
- # upstream, so gating db alone cascades to the rest of the stack.
+ # .erlang.cookie write, producing `eacces` at broker boot. migrate and the
+ # backend services all depends_on db:service_healthy, so gating db alone
+ # cascades to the rest of the stack.
db:
- <<: *supabase-services
- extends:
- file: ./db/docker/docker-compose.yml
- service: db
+ <<: *agpt-services
+ # Pinned to pg15 to track the managed Postgres major that prod and dev
+ # run; testing on a newer major than production is skew we don't want.
+ image: pgvector/pgvector:pg15
+ restart: unless-stopped
ports:
- - 5432:5432 # We don't use Supavisor locally, so we expose the db directly.
+ - 5432:5432
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: your-super-secret-and-long-postgres-password
+ POSTGRES_DB: postgres
+ volumes:
+ # Creates the platform schema + the legacy auth.users shim that
+ # historical Prisma migrations reference. Only runs on a fresh volume.
+ - ./db/init/00-init.sql:/docker-entrypoint-initdb.d/00-init.sql:ro
+ - ./data/db/data:/var/lib/postgresql/data
+ healthcheck:
+ test: ["CMD", "pg_isready", "-U", "postgres", "-h", "localhost"]
+ interval: 5s
+ timeout: 5s
+ retries: 10
depends_on:
rabbitmq:
condition: service_healthy
- # Studio and its dependencies for local development only
- meta:
- <<: *supabase-services
- profiles:
- - local
- extends:
- file: ./db/docker/docker-compose.yml
- service: meta
-
- studio:
- <<: *supabase-services
- profiles:
- - local
- extends:
- file: ./db/docker/docker-compose.yml
- service: studio
- depends_on:
- meta:
- condition: service_healthy
- # environment:
- # NEXT_PUBLIC_ENABLE_LOGS: false # Disable analytics/logging features
-
deps:
- <<: *supabase-services
+ <<: *agpt-services
profiles:
- local
image: busybox
command: /bin/true
depends_on:
- - kong
- - auth
- db
- - studio
- redis-0
- redis-1
- redis-2
diff --git a/autogpt_platform/frontend/.env.default b/autogpt_platform/frontend/.env.default
index 593755240b..42ab15b6d7 100644
--- a/autogpt_platform/frontend/.env.default
+++ b/autogpt_platform/frontend/.env.default
@@ -1,6 +1,44 @@
-# Supabase
-NEXT_PUBLIC_SUPABASE_URL=http://localhost:8000
-NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
+# Better Auth (runs inside this Next.js app at /api/auth/*)
+# Dev-only default. MUST be overridden with a real secret in production.
+BETTER_AUTH_SECRET=dev-only-better-auth-secret-9f4e8c2a71b6d05e3a8f12c4b7d9e6a1
+BETTER_AUTH_URL=http://localhost:3000
+# Postgres connection for Better Auth; tables live in the platform schema
+# (created by the backend's Prisma migrations).
+DATABASE_URL=postgresql://postgres:your-super-secret-and-long-postgres-password@localhost:5432/postgres
+AUTH_DB_SCHEMA=platform
+# Set to true to block sign-in until the email is verified. There is no SMTP
+# setting here: auth emails are sent by the backend's Postmark mailer (see the
+# note below), so configure POSTMARK_* in backend/.env before enabling this.
+AUTH_REQUIRE_EMAIL_VERIFICATION=false
+
+# Signup gating (env-driven; replaces the old DB allowlist trigger).
+# Prod leaves both unset = open signup. Dev/preview sets the allowlist so
+# randoms can't register on a public preview URL.
+# AUTH_ALLOW_NEW_ACCOUNTS "false" blocks ALL new signups. Default: open.
+# AUTH_SIGNUP_ALLOWLIST comma-separated allowed emails and @domains;
+# empty/unset = open. e.g. "@agpt.co,[email protected]"
+# AUTH_ALLOW_NEW_ACCOUNTS=true
+# AUTH_SIGNUP_ALLOWLIST=
+
+# Social login providers (enabled when both values of a pair are set)
+# AUTH_GOOGLE_CLIENT_ID=
+# AUTH_GOOGLE_CLIENT_SECRET=
+# AUTH_GITHUB_CLIENT_ID=
+# AUTH_GITHUB_CLIENT_SECRET=
+# AUTH_DISCORD_CLIENT_ID=
+# AUTH_DISCORD_CLIENT_SECRET=
+
+# Better Auth verification / password-reset emails are sent through the backend
+# mailer (Postmark) via POST {backend}/api/auth-email/send, authenticated with a
+# short-lived service token signed by the Better Auth JWKS key the backend
+# already trusts (JWT_JWKS_URL) — nothing to configure here. If the send fails
+# outside production (e.g. no local Postmark), the link is logged to the server
+# console instead.
+
+# Only needed to bridge pre-migration Supabase sessions: keep the old GoTrue
+# JWT secret set during the migration window so existing logins carry over.
+# SUPABASE_JWT_SECRET=
+# SUPABASE_BRIDGE_MAX_TOKEN_AGE_DAYS=30
# Back-end services
NEXT_PUBLIC_AGPT_SERVER_URL=http://localhost:8006/api
diff --git a/autogpt_platform/frontend/README.md b/autogpt_platform/frontend/README.md
index aec05dfbbb..becba46ebc 100644
--- a/autogpt_platform/frontend/README.md
+++ b/autogpt_platform/frontend/README.md
@@ -169,7 +169,7 @@ By integrating Storybook into our development workflow, we can streamline UI dev
### Backend & Services
-- [**Supabase**](https://supabase.com/) - Backend-as-a-Service (database, auth, storage)
+- [**Better Auth**](https://www.better-auth.com/) - Authentication (sessions, OAuth, JWTs) served from `/api/auth/*`
- [**Sentry**](https://sentry.io/) - Error monitoring and performance tracking
### Package Management
diff --git a/autogpt_platform/frontend/TESTING.md b/autogpt_platform/frontend/TESTING.md
index ee8ed5d9cf..72a92b17e5 100644
--- a/autogpt_platform/frontend/TESTING.md
+++ b/autogpt_platform/frontend/TESTING.md
@@ -102,7 +102,7 @@ All handlers are aggregated in `src/mocks/mock-handlers.ts` and the MSW server i
- **`@/tests/integrations/test-utils`** — custom `render()` that wraps components with `QueryClientProvider`, `BackendAPIProvider`, `OnboardingProvider`, `NuqsTestingAdapter`, and `TooltipProvider`, so query-state hooks and tooltips work out of the box in page-level tests
- **`@/tests/integrations/setup-nextjs-mocks`** — mocks for `next/navigation`, `next/image`, `next/headers`, `next/link`
-- **`@/tests/integrations/mock-supabase-request`** — mocks Supabase auth (returns null user by default)
+- **`@/tests/integrations/mock-auth-request`** — mocks Better Auth (returns null session by default)
### What to test at page level
@@ -129,7 +129,7 @@ pnpm exec playwright test # run the same eight-spec Playwright suite directly
### Setup
-1. Start the backend + Supabase stack:
+1. Start the backend stack (Postgres, Redis, RabbitMQ, API):
- From `autogpt_platform`: `docker compose --profile local up deps_backend -d`
2. Seed rich E2E data (creates `[email protected]` with library agents):
- From `autogpt_platform/backend`: `poetry run python test/e2e_test_data.py`
diff --git a/autogpt_platform/frontend/package.json b/autogpt_platform/frontend/package.json
index 0e94f23d55..9bf2737bea 100644
--- a/autogpt_platform/frontend/package.json
+++ b/autogpt_platform/frontend/package.json
@@ -68,8 +68,6 @@
"@streamdown/cjk": "1.0.1",
"@streamdown/math": "1.0.1",
"@streamdown/mermaid": "1.0.1",
- "@supabase/ssr": "0.7.0",
- "@supabase/supabase-js": "2.78.0",
"@tanstack/react-query": "5.90.6",
"@tanstack/react-table": "8.21.3",
"@types/jaro-winkler": "0.2.4",
@@ -77,6 +75,8 @@
"@vercel/speed-insights": "1.2.0",
"@xyflow/react": "12.9.2",
"ai": "6.0.134",
+ "bcryptjs": "3.0.3",
+ "better-auth": "1.6.14",
"boring-avatars": "1.11.2",
"canvas-confetti": "1.9.4",
"class-variance-authority": "0.7.1",
@@ -93,6 +93,7 @@
"geist": "1.5.1",
"highlight.js": "11.11.1",
"jaro-winkler": "0.2.8",
+ "jose": "6.2.3",
"jszip": "3.10.1",
"katex": "0.16.25",
"launchdarkly-react-client-sdk": "3.9.0",
@@ -102,6 +103,7 @@
"next": "15.5.18",
"next-themes": "0.4.6",
"nuqs": "2.7.2",
+ "pg": "8.21.0",
"posthog-js": "1.334.1",
"react": "18.3.1",
"react-currency-input-field": "4.0.3",
@@ -150,10 +152,12 @@
"@testing-library/dom": "10.4.1",
"@testing-library/react": "16.3.2",
"@testing-library/user-event": "14.6.1",
+ "@types/bcryptjs": "3.0.0",
"@types/canvas-confetti": "1.9.0",
"@types/lodash": "4.17.20",
"@types/negotiator": "0.6.4",
"@types/node": "24.10.0",
+ "@types/pg": "8.20.0",
"@types/react": "18.3.17",
"@types/react-dom": "18.3.5",
"@types/react-modal": "3.16.3",
@@ -192,9 +196,11 @@
]
},
"pnpm": {
+ "//kysely": "DO NOT UPGRADE past 0.28.x: @better-auth/kysely-adapter (better-auth) imports DEFAULT_MIGRATION_LOCK_TABLE from the kysely root, which 0.29 moved to kysely/migration — upgrading crashes every /api/auth route. Revisit when better-auth's adapter supports kysely 0.29+.",
"overrides": {
"@opentelemetry/instrumentation": "0.209.0",
- "lodash-es": "4.17.23"
+ "lodash-es": "4.17.23",
+ "kysely": "0.28.17"
}
},
"packageManager": "[email protected]+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd"
diff --git a/autogpt_platform/frontend/pnpm-lock.yaml b/autogpt_platform/frontend/pnpm-lock.yaml
index 1374f300fc..6db0365d9f 100644
--- a/autogpt_platform/frontend/pnpm-lock.yaml
+++ b/autogpt_platform/frontend/pnpm-lock.yaml
@@ -7,6 +7,7 @@ settings:
overrides:
'@opentelemetry/instrumentation': 0.209.0
lodash-es: 4.17.23
+ kysely: 0.28.17
importers:
@@ -120,12 +121,6 @@ importers:
'@streamdown/mermaid':
specifier: 1.0.1
version: 1.0.1([email protected])
- '@supabase/ssr':
- specifier: 0.7.0
- version: 0.7.0(@supabase/[email protected])
- '@supabase/supabase-js':
- specifier: 2.78.0
- version: 2.78.0
'@tanstack/react-query':
specifier: 5.90.6
version: 5.90.6([email protected])
@@ -147,6 +142,12 @@ importers:
ai:
specifier: 6.0.134
version: 6.0.134([email protected])
+ bcryptjs:
+ specifier: 3.0.3
+ version: 3.0.3
+ better-auth:
+ specifier: 1.6.14
boring-avatars:
specifier: 1.11.2
version: 1.11.2
@@ -195,6 +196,9 @@ importers:
jaro-winkler:
specifier: 0.2.8
version: 0.2.8
+ jose:
+ specifier: 6.2.3
+ version: 6.2.3
jszip:
specifier: 3.10.1
version: 3.10.1
@@ -222,6 +226,9 @@ importers:
nuqs:
specifier: 2.7.2
+ pg:
+ specifier: 8.21.0
+ version: 8.21.0
posthog-js:
specifier: 1.334.1
version: 1.334.1
@@ -361,6 +368,9 @@ importers:
'@testing-library/user-event':
specifier: 14.6.1
version: 14.6.1(@testing-library/[email protected])
+ '@types/bcryptjs':
+ specifier: 3.0.0
+ version: 3.0.0
'@types/canvas-confetti':
specifier: 1.9.0
version: 1.9.0
@@ -373,6 +383,9 @@ importers:
'@types/node':
specifier: 24.10.0
version: 24.10.0
+ '@types/pg':
+ specifier: 8.20.0
+ version: 8.20.0
'@types/react':
specifier: 18.3.17
version: 18.3.17
@@ -393,7 +406,7 @@ importers:
'@vitest/coverage-v8':
specifier: 4.0.17
agentation:
specifier: 3.0.2
@@ -465,7 +478,7 @@ importers:
vitest:
specifier: 4.0.17
packages:
@@ -1144,6 +1157,85 @@ packages:
resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==}
engines: {node: '>=18'}
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-12cA7tnR4Wyb3nLpPmeq/Id7QNB+4OhjbzuX7sIhqglgXGjyT5iiNpe2lx/8FF532sHC450Yx1850salCYbkzw==}
+ peerDependencies:
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+ '@cloudflare/workers-types': '>=4'
+ '@opentelemetry/api': ^1.9.0
+ better-call: 1.3.5
+ jose: ^6.1.0
+ kysely: 0.28.17
+ nanostores: ^1.0.1
+ peerDependenciesMeta:
+ '@cloudflare/workers-types':
+ optional: true
+ '@opentelemetry/api':
+ optional: true
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-lYs1jDudriKYMXNcLFLAvEvOEKbeKBFdDciG4H8qZhV+3+yghGC3f/H5qtgTDc8mGBPV+2tEvVgYqReurOSmNw==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+ drizzle-orm: ^0.45.2
+ peerDependenciesMeta:
+ drizzle-orm:
+ optional: true
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-A2+381gYADuZpgd98XQ39bnxLzbT03wnnDmSQIXp7XcE3hF093mGMk6rxlAhENVHH7JL2B0Tv2la2o6n+6ppyQ==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+ kysely: 0.28.17
+ peerDependenciesMeta:
+ kysely:
+ optional: true
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-frtBTozi8qsBlypxp33dkiIZT2IOMvix3oh2qTTcBkK11ISsRSTUUadl7DbwXri2AEoooShsH6PSAput920J3Q==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-meaZx712k9c0Cl6urwYZRNa3mAy3/leaYiSNt+hVaCOEPlgTDxzmYMNACvTTYXgh4eCpDVf5G7ZMEYBtejKQdw==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+ mongodb: ^6.0.0 || ^7.0.0
+ peerDependenciesMeta:
+ mongodb:
+ optional: true
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-9b9wSqhCthMmOYo0QdX+N/cOv+fNck/JE5CZQuuWwEJl5QeoYhCZesXjts5VfLAPMIf6vKw3QNBrn0SVMXXi2Q==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+ '@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0
+ prisma: ^5.0.0 || ^6.0.0 || ^7.0.0
+ peerDependenciesMeta:
+ '@prisma/client':
+ optional: true
+ prisma:
+ optional: true
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-ALi3cEx5eyrFY+TeAdhc1uq8FqJyGvzgvIo7GQZOqGqLZxHY9nte44WN++jBFGJJbsW3e4cgLj8dQK291s6wWQ==}
+ peerDependencies:
+ '@better-auth/core': ^1.6.14
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+
+ '@better-auth/[email protected]':
+ resolution: {integrity: sha512-SZBPRPF3z0nBvE5ygOkxae35wnnXPRShmqFo78S+qslLeFoPu/pMgnXAuNKFMMybac3tiLaVg1e3MQW5MC+1iA==}
+
+ '@better-fetch/[email protected]':
+ resolution: {integrity: sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A==}
+
'@braintree/[email protected]':
resolution: {integrity: sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==}
@@ -1942,6 +2034,14 @@ packages:
next: ^13.0.0 || ^14.0.0 || ^15.0.0
react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
+ '@noble/[email protected]':
+ resolution: {integrity: sha512-Z6pjIZ/8IJcCGzb2S/0Px5J81yij85xASuk1teLNeg75bfT07MV3a/O2Mtn1I2se43k3lkVEcFaR10N4cgQcZA==}
+ engines: {node: '>= 20.19.0'}
+
+ '@noble/[email protected]':
+ resolution: {integrity: sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==}
+ engines: {node: '>= 20.19.0'}
+
'@nodelib/[email protected]':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -2185,6 +2285,10 @@ packages:
resolution: {integrity: sha512-kocjix+/sSggfJhwXqClZ3i9Y/MI0fp7b+g7kCRm6psy2dsf8uApTRclwG18h8Avm7C9+fnt+O36PspJ/OzoWg==}
engines: {node: '>=14'}
+ '@opentelemetry/[email protected]':
+ resolution: {integrity: sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA==}
+ engines: {node: '>=14'}
+
'@opentelemetry/[email protected]':
resolution: {integrity: sha512-4mhWm3Z8z+i508zQJ7r6Xi7y4mmoJpdvH0fZPFRkWrdp5fq7hhZ2HhYokEOLkfqSMgPR4Z9EyB3DBkbKGOqZiQ==}
engines: {node: ^18.19.0 || >=20.6.0}
@@ -3433,33 +3537,6 @@ packages:
peerDependencies:
react: ^18.0.0 || ^19.0.0
- '@supabase/[email protected]':
- resolution: {integrity: sha512-cXDtu1U0LeZj/xfnFoV7yCze37TcbNo8FCxy1FpqhMbB9u9QxxDSW6pA5gm/07Ei7m260Lof4CZx67Cu6DPeig==}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-t1jOvArBsOINyqaRee1xJ3gryXLvkBzqnKfi6q3YRzzhJbGS6eXz0pXR5fqmJeB01fLC+1njpf3YhMszdPEF7g==}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==}
- engines: {node: 4.x || >=6.0.0}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-AwhpYlSvJ+PSnPmIK8sHj7NGDyDENYfQGKrMtpVIEzQA2ApUjgpUGxzXWN4Z0wEtLQsvv7g4y9HVad9Hzo1TNA==}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-rCs1zmLe7of7hj4s7G9z8rTqzWuNVtmwDr3FiCRCJFawEoa+RQO1xpZGbdeuVvVmKDyVN6b542Okci+117y/LQ==}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-G65t5EhLSJ5c8hTCcXifSL9Q/ZRXvqgXeNo+d3P56f4U1IxwTqjB64UfmfixvmMcjuxnq2yGqEWVJqUcO+AzAg==}
- peerDependencies:
- '@supabase/supabase-js': ^2.43.4
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-n17P0JbjHOlxqJpkaGFOn97i3EusEKPEbWOpuk1r4t00Wg06B8Z4GUiq0O0n1vUpjiMgJUkLIMuBVp+bEgunzQ==}
-
- '@supabase/[email protected]':
- resolution: {integrity: sha512-xYMRNBFmKp2m1gMuwcp/gr/HlfZKqjye1Ib8kJe29XJNsgwsfO/f8skxnWiscFKTlkOKLuBexNgl5L8dzGt6vA==}
-
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
@@ -3555,6 +3632,10 @@ packages:
resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-WRZOuCuaz8UcZZE4R5HXTco2goQSI2XxjGY3hbM/xDvwmqFWd4ivooImsMx65OKM6CtNKbnZ5YL+YwAwK7c1dg==}
+ deprecated: This is a stub types definition. bcryptjs provides its own type definitions, so you do not need this installed.
+
resolution: {integrity: sha512-aBGj/dULrimR1XDZLtG9JwxX1b4HPRF6CX9Yfwh3NvstZEm1ZL7RBnel4keCPSqs1ANRu1u2Aoz9R+VmtjYuTg==}
@@ -3735,8 +3816,8 @@ packages:
resolution: {integrity: sha512-NoaMtzhxOrubeL/7UZuNTrejB4MPAJ0RpxZqXQf2qXuVlTPuG6Y8p4u9dKRaue4yjmC7ZhzVO2/Yyyn25znrPQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-oN9ive//QSBkf19rfDv45M7eZPi0eEXylht2OLEXicu5b4KoQ1OzXIw+xDSGWxSxe1JmepRR/ZH283vsu518/Q==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==}
resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}
@@ -4434,6 +4515,80 @@ packages:
resolution: {integrity: sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==}
hasBin: true
+ resolution: {integrity: sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g==}
+ hasBin: true
+
+ resolution: {integrity: sha512-c0/DvTQGDpgfj1knekCpQrg6PSWGDtfAtP7Ou6FkAhoE3RNnnIxLB5qKj6tRg53a1xsq93G6T68cNxrUZ7ZVmw==}
+ peerDependencies:
+ '@lynx-js/react': '*'
+ '@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0
+ '@sveltejs/kit': ^2.0.0
+ '@tanstack/react-start': ^1.0.0
+ '@tanstack/solid-start': ^1.0.0
+ better-sqlite3: ^12.0.0
+ drizzle-kit: '>=0.31.4'
+ drizzle-orm: ^0.45.2
+ mongodb: ^6.0.0 || ^7.0.0
+ mysql2: ^3.0.0
+ next: ^14.0.0 || ^15.0.0 || ^16.0.0
+ pg: ^8.0.0
+ prisma: ^5.0.0 || ^6.0.0 || ^7.0.0
+ react: ^18.0.0 || ^19.0.0
+ react-dom: ^18.0.0 || ^19.0.0
+ solid-js: ^1.0.0
+ svelte: ^4.0.0 || ^5.0.0
+ vitest: ^2.0.0 || ^3.0.0 || ^4.0.0
+ vue: ^3.0.0
+ peerDependenciesMeta:
+ '@lynx-js/react':
+ optional: true
+ '@prisma/client':
+ optional: true
+ '@sveltejs/kit':
+ optional: true
+ '@tanstack/react-start':
+ optional: true
+ '@tanstack/solid-start':
+ optional: true
+ better-sqlite3:
+ optional: true
+ drizzle-kit:
+ optional: true
+ drizzle-orm:
+ optional: true
+ mongodb:
+ optional: true
+ mysql2:
+ optional: true
+ next:
+ optional: true
+ pg:
+ optional: true
+ prisma:
+ optional: true
+ react:
+ optional: true
+ react-dom:
+ optional: true
+ solid-js:
+ optional: true
+ svelte:
+ optional: true
+ vitest:
+ optional: true
+ vue:
+ optional: true
+
+ resolution: {integrity: sha512-kOFJkBP7utAQLEYrobZm3vkTH8mXq5GNgvjc5/XEST1ilVHaxXUXfeDeFlqoETMtyqS4+3/h4ONX2i++ebZrvA==}
+ peerDependencies:
+ zod: ^4.0.0
+ peerDependenciesMeta:
+ zod:
+ optional: true
+
resolution: {integrity: sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ==}
engines: {node: '>=12.0.0'}
@@ -5097,6 +5252,9 @@ packages:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==}
+
resolution: {integrity: sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==}
@@ -6299,6 +6457,9 @@ packages:
resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==}
hasBin: true
+ resolution: {integrity: sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw==}
+
resolution: {integrity: sha512-TFNZZDa/0ewCLQyRC/Sq9crtixNj/Xdf/wmj9631xxMuKToVJZDbqcHIYN0OboH+7kh6P6tpIK7uKWClj86PKw==}
engines: {node: '>=12.20.0'}
@@ -6443,6 +6604,10 @@ packages:
resolution: {integrity: sha512-TrM4/tnNY7uJ1aW55sIIa+dqBvc4V14WRIAlGcWat9wV5pRS9Wr5Zk2ZTjQP1jtfIHDoHiSbPuV08P0fUZo2pg==}
engines: {node: '>= 18'}
+ resolution: {integrity: sha512-nbD8lB9EB3wNdMhOCdx5Li8DxnLbvKByylRLcJ1h+4SkrowVeECAyZlyiKMThF7xFdRz0jSQ2MoJr+wXux2y0Q==}
+ engines: {node: '>=20.0.0'}
+
resolution: {integrity: sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==}
engines: {node: '>=16.0.0'}
@@ -6973,6 +7138,10 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
+ resolution: {integrity: sha512-XPUa/jz+P1oJvN9VBxw4L9MtdFfaH3DAryqPssqhb2kXjmb9npz0dly6rCsgFWOPr4Yg9mTfM3MDZgZZ+7A3lA==}
+ engines: {node: ^20.0.0 || >=22.0.0}
+
resolution: {integrity: sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@@ -7315,17 +7484,43 @@ packages:
resolution: {integrity: sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ==}
engines: {node: '>= 0.10'}
+ resolution: {integrity: sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==}
+
+ resolution: {integrity: sha512-EMnU9E2fSULdsbErBbMaXJvFeD9B4+nPcM3f+4lsiCR0BHLPrLVjv3DbyM2hgQQviKJaTWIRRTjKjWlHg3p2ig==}
+
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
engines: {node: '>=4.0.0'}
+ resolution: {integrity: sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==}
+ peerDependencies:
+ pg: '>=8.0'
+
resolution: {integrity: sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==}
+ resolution: {integrity: sha512-n5taZ1kO3s9ngDTVxsEznOqCyToTgz0FLuPq0B33COy5pPpuWJpY3/2oRBVETuOgzdqRXfWpM9HIhp2LBBT1BA==}
+
resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
engines: {node: '>=4'}
+ resolution: {integrity: sha512-AUP1EYJuHraQGsVoCQVIcM7TEJVGtDzxWtGFZd8rds9d+CCXlU5Js1rYgfLNvxy9iJrpHjGrRjoi/3BT9fRyiA==}
+ engines: {node: '>= 16.0.0'}
+ peerDependencies:
+ pg-native: '>=3.0.1'
+ peerDependenciesMeta:
+ pg-native:
+ optional: true
+
+ resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
+
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -7976,6 +8171,9 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
+ resolution: {integrity: sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==}
+
resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}
@@ -8060,6 +8258,9 @@ packages:
resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
+ resolution: {integrity: sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw==}
+
resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
engines: {node: '>= 0.4'}
@@ -8189,6 +8390,10 @@ packages:
resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
+ resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
+ engines: {node: '>= 10.x'}
+
resolution: {integrity: sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==}
@@ -8471,8 +8676,8 @@ packages:
resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}
engines: {node: '>=14.0.0'}
- resolution: {integrity: sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==}
+ resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==}
engines: {node: '>=14.0.0'}
@@ -9119,6 +9324,9 @@ packages:
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
+ resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==}
+
resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==}
engines: {node: '>=12.7.0'}
@@ -9299,15 +9507,15 @@ snapshots:
dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
'@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.31
jsesc: 3.1.0
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
@@ -9353,14 +9561,14 @@ snapshots:
dependencies:
'@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
dependencies:
'@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
@@ -9375,7 +9583,7 @@ snapshots:
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
'@babel/[email protected]': {}
@@ -9400,7 +9608,7 @@ snapshots:
dependencies:
'@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
@@ -9414,18 +9622,18 @@ snapshots:
dependencies:
'@babel/template': 7.27.2
'@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
dependencies:
'@babel/template': 7.27.2
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
@@ -9801,7 +10009,7 @@ snapshots:
'@babel/helper-module-imports': 7.27.1
'@babel/helper-plugin-utils': 7.27.1
'@babel/plugin-syntax-jsx': 7.27.1(@babel/[email protected])
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
transitivePeerDependencies:
- supports-color
@@ -9981,7 +10189,7 @@ snapshots:
dependencies:
'@babel/core': 7.28.5
'@babel/helper-plugin-utils': 7.27.1
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
esutils: 2.0.3
@@ -10012,17 +10220,17 @@ snapshots:
dependencies:
'@babel/code-frame': 7.27.1
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
dependencies:
'@babel/code-frame': 7.27.1
'@babel/generator': 7.28.5
'@babel/helper-globals': 7.28.0
- '@babel/parser': 7.28.5
+ '@babel/parser': 7.29.2
'@babel/template': 7.27.2
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
debug: 4.4.3
transitivePeerDependencies:
- supports-color
@@ -10039,6 +10247,59 @@ snapshots:
'@bcoe/[email protected]': {}
+ dependencies:
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+ '@opentelemetry/semantic-conventions': 1.41.1
+ '@standard-schema/spec': 1.1.0
+ better-call: 1.3.5([email protected])
+ jose: 6.2.3
+ kysely: 0.28.17
+ nanostores: 1.3.0
+ zod: 4.4.3
+ optionalDependencies:
+ '@opentelemetry/api': 1.9.0
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+ optionalDependencies:
+ kysely: 0.28.17
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+
+ '@better-auth/[email protected]':
+ dependencies:
+ '@noble/hashes': 2.2.0
+
+ '@better-fetch/[email protected]': {}
+
'@braintree/[email protected]': {}
'@chevrotain/[email protected]':
@@ -10309,7 +10570,9 @@ snapshots:
'@eslint/[email protected]': {}
- '@exodus/[email protected]':
+ optionalDependencies:
+ '@noble/hashes': 2.2.0
optional: true
'@exodus/[email protected]': {}
@@ -10635,6 +10898,10 @@ snapshots:
react: 18.3.1
third-party-capital: 1.0.20
+ '@noble/[email protected]': {}
+
+ '@noble/[email protected]': {}
+
'@nodelib/[email protected]':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -10934,6 +11201,8 @@ snapshots:
'@opentelemetry/[email protected]': {}
+ '@opentelemetry/[email protected]': {}
+
'@opentelemetry/[email protected](@opentelemetry/[email protected])':
dependencies:
'@opentelemetry/api': 1.9.0
@@ -12485,58 +12754,6 @@ snapshots:
mermaid: 11.12.2
react: 18.3.1
- '@supabase/[email protected]':
- dependencies:
- '@supabase/node-fetch': 2.6.15
- tslib: 2.8.1
-
- '@supabase/[email protected]':
- dependencies:
- '@supabase/node-fetch': 2.6.15
- tslib: 2.8.1
-
- '@supabase/[email protected]':
- dependencies:
- whatwg-url: 5.0.0
-
- '@supabase/[email protected]':
- dependencies:
- '@supabase/node-fetch': 2.6.15
- tslib: 2.8.1
-
- '@supabase/[email protected]':
- dependencies:
- '@supabase/node-fetch': 2.6.15
- '@types/phoenix': 1.6.7
- '@types/ws': 8.18.1
- tslib: 2.8.1
- ws: 8.19.0
- transitivePeerDependencies:
- - bufferutil
- - utf-8-validate
-
- '@supabase/[email protected](@supabase/[email protected])':
- dependencies:
- '@supabase/supabase-js': 2.78.0
- cookie: 1.0.2
-
- '@supabase/[email protected]':
- dependencies:
- '@supabase/node-fetch': 2.6.15
- tslib: 2.8.1
-
- '@supabase/[email protected]':
- dependencies:
- '@supabase/auth-js': 2.78.0
- '@supabase/functions-js': 2.78.0
- '@supabase/node-fetch': 2.6.15
- '@supabase/postgrest-js': 2.78.0
- '@supabase/realtime-js': 2.78.0
- '@supabase/storage-js': 2.78.0
- transitivePeerDependencies:
- - bufferutil
- - utf-8-validate
-
dependencies:
tslib: 2.8.1
@@ -12633,16 +12850,20 @@ snapshots:
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
dependencies:
- '@babel/parser': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
dependencies:
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
+
+ '@types/[email protected]':
+ dependencies:
+ bcryptjs: 3.0.3
'@types/[email protected]': {}
@@ -12842,7 +13063,7 @@ snapshots:
dependencies:
- '@types/pg': 8.15.6
+ '@types/pg': 8.20.0
dependencies:
@@ -12850,7 +13071,11 @@ snapshots:
pg-protocol: 1.10.3
pg-types: 2.2.0
- '@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 24.10.0
+ pg-protocol: 1.14.0
+ pg-types: 2.2.0
'@types/[email protected]': {}
@@ -13081,7 +13306,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@bcoe/v8-coverage': 1.0.2
'@vitest/utils': 4.0.17
@@ -13092,8 +13317,8 @@ snapshots:
magicast: 0.5.2
obug: 2.1.1
std-env: 3.10.0
- tinyrainbow: 3.0.3
+ tinyrainbow: 3.1.0
'@vitest/[email protected]':
dependencies:
@@ -13110,7 +13335,7 @@ snapshots:
'@vitest/spy': 4.0.17
'@vitest/utils': 4.0.17
chai: 6.2.2
- tinyrainbow: 3.0.3
+ tinyrainbow: 3.1.0
dependencies:
@@ -13136,7 +13361,7 @@ snapshots:
'@vitest/[email protected]':
dependencies:
- tinyrainbow: 3.0.3
+ tinyrainbow: 3.1.0
'@vitest/[email protected]':
dependencies:
@@ -13164,7 +13389,7 @@ snapshots:
'@vitest/[email protected]':
dependencies:
'@vitest/pretty-format': 4.0.17
- tinyrainbow: 3.0.3
+ tinyrainbow: 3.1.0
'@webassemblyjs/[email protected]':
dependencies:
@@ -13577,6 +13802,46 @@ snapshots:
+
+ dependencies:
+ '@better-auth/drizzle-adapter': 1.6.14(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/memory-adapter': 1.6.14(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/mongo-adapter': 1.6.14(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/prisma-adapter': 1.6.14(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/telemetry': 1.6.14(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+ '@noble/ciphers': 2.2.0
+ '@noble/hashes': 2.2.0
+ better-call: 1.3.5([email protected])
+ defu: 6.1.7
+ jose: 6.2.3
+ kysely: 0.28.17
+ nanostores: 1.3.0
+ zod: 4.4.3
+ optionalDependencies:
+ pg: 8.21.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ transitivePeerDependencies:
+ - '@cloudflare/workers-types'
+ - '@opentelemetry/api'
+
+ dependencies:
+ '@better-auth/utils': 0.4.1
+ '@better-fetch/fetch': 1.1.21
+ rou3: 0.7.12
+ set-cookie-parser: 3.1.0
+ optionalDependencies:
+ zod: 4.4.3
+
dependencies:
open: 8.4.2
@@ -14280,6 +14545,8 @@ snapshots:
has-property-descriptors: 1.0.2
object-keys: 1.1.1
+
dependencies:
robust-predicates: 3.0.2
@@ -15423,9 +15690,9 @@ snapshots:
dependencies:
react-is: 16.13.1
dependencies:
- '@exodus/bytes': 1.9.0
+ '@exodus/bytes': 1.9.0(@noble/[email protected])
transitivePeerDependencies:
- '@noble/hashes'
optional: true
@@ -15788,6 +16055,8 @@ snapshots:
+
optionalDependencies:
'@babel/core': 7.28.5
@@ -15807,15 +16076,15 @@ snapshots:
dependencies:
argparse: 2.0.1
dependencies:
'@acemir/cssom': 0.9.31
'@asamuzakjp/dom-selector': 6.7.6
- '@exodus/bytes': 1.9.0
+ '@exodus/bytes': 1.9.0(@noble/[email protected])
cssstyle: 5.3.7
data-urls: 6.0.1
decimal.js: 10.6.0
- html-encoding-sniffer: 6.0.0
+ html-encoding-sniffer: 6.0.0(@noble/[email protected])
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.6
is-potential-custom-element-name: 1.0.1
@@ -15953,6 +16222,8 @@ snapshots:
type-is: 2.0.1
vary: 1.1.2
+
dependencies:
chevrotain: 11.0.3
@@ -16729,6 +17000,8 @@ snapshots:
+
@@ -17145,10 +17418,21 @@ snapshots:
sha.js: 2.4.12
to-buffer: 1.2.2
+ optional: true
+
+
+ dependencies:
+ pg: 8.21.0
+
+
dependencies:
pg-int8: 1.0.1
@@ -17157,6 +17441,20 @@ snapshots:
postgres-date: 1.0.7
postgres-interval: 1.2.0
+ dependencies:
+ pg-connection-string: 2.13.0
+ pg-pool: 3.14.0([email protected])
+ pg-protocol: 1.14.0
+ pg-types: 2.2.0
+ pgpass: 1.0.5
+ optionalDependencies:
+ pg-cloudflare: 1.4.0
+
+ dependencies:
+ split2: 4.2.0
+
@@ -17413,7 +17711,7 @@ snapshots:
dependencies:
'@babel/core': 7.28.5
'@babel/traverse': 7.28.5
- '@babel/types': 7.28.5
+ '@babel/types': 7.29.0
'@types/babel__core': 7.20.5
'@types/babel__traverse': 7.28.0
'@types/doctrine': 0.0.9
@@ -17882,6 +18180,8 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.55.1
fsevents: 2.3.3
+
dependencies:
hachure-fill: 0.5.2
@@ -17962,6 +18262,8 @@ snapshots:
dependencies:
randombytes: 2.1.0
+
dependencies:
define-data-property: 1.1.4
@@ -18141,6 +18443,8 @@ snapshots:
+
@@ -18482,7 +18786,7 @@ snapshots:
@@ -18890,7 +19194,7 @@ snapshots:
terser: 5.44.1
yaml: 2.8.2
dependencies:
'@vitest/expect': 4.0.17
@@ -18909,14 +19213,14 @@ snapshots:
tinybench: 2.9.0
tinyexec: 1.0.2
tinyglobby: 0.2.15
- tinyrainbow: 3.0.3
+ tinyrainbow: 3.1.0
why-is-node-running: 2.3.0
optionalDependencies:
'@opentelemetry/api': 1.9.0
'@types/node': 24.10.0
happy-dom: 20.3.4
- jsdom: 27.4.0
+ jsdom: 27.4.0(@noble/[email protected])
transitivePeerDependencies:
- jiti
- less
@@ -19157,6 +19461,8 @@ snapshots:
+
dependencies:
use-sync-external-store: 1.6.0([email protected])
diff --git a/autogpt_platform/frontend/scripts/migrate-supabase-auth.ts b/autogpt_platform/frontend/scripts/migrate-supabase-auth.ts
new file mode 100644
index 0000000000..eeff16e519
--- /dev/null
+++ b/autogpt_platform/frontend/scripts/migrate-supabase-auth.ts
@@ -0,0 +1,232 @@
+/**
+ * Post-cutover sweep of Supabase GoTrue users into the Better Auth tables.
+ *
+ * The BULK copy is done by backend Prisma migration
+ * 20260716120000_copy_supabase_users_to_better_auth, which runs in the
+ * normal `prisma migrate deploy` pipeline step. This script is the same
+ * copy as a re-runnable sweep: run it once AFTER the frontend has switched
+ * to Better Auth, to catch users who signed up (or changed identities) via
+ * GoTrue between the migration running and the flip. Trigger it via the
+ * "Supabase Auth Sweep" GitHub workflow, or by hand.
+ *
+ * Copies:
+ * - auth.users -> platform."UserAuthIdentity"
+ * - email/password -> platform."UserAuthAccount" (providerId = 'credential';
+ * bcrypt hashes carry over because Better Auth is
+ * configured to verify with bcrypt)
+ * - auth.identities -> platform."UserAuthAccount" (google / github / discord)
+ *
+ * Keep SUPABASE_JWT_SECRET set in the frontend environment for the duration
+ * of the bridge window so pre-migration sessions keep working.
+ *
+ * Usage:
+ * DATABASE_URL=postgresql://... npx tsx scripts/migrate-supabase-auth.ts
+ *
+ * Idempotent: every insert is guarded (ON CONFLICT DO NOTHING / NOT EXISTS),
+ * so the script is safe to re-run. Each batch of users runs in its own
+ * transaction; the script exits non-zero on the first failed batch.
+ * NOTE: a password CHANGED via GoTrue after the user was copied is not
+ * re-copied (the existing credential account wins) — those users reset
+ * their password through the normal flow.
+ */
+import { Pool } from "pg";
+
+const BATCH_SIZE = 1000;
+
+async function tableExists(pool: Pool, qualifiedName: string) {
+ const { rows } = await pool.query<{ reg: string | null }>(
+ "SELECT to_regclass($1)::text AS reg",
+ [qualifiedName],
+ );
+ return rows[0]?.reg != null;
+}
+
+async function columnExists(
+ pool: Pool,
+ schema: string,
+ table: string,
+ column: string,
+) {
+ const { rows } = await pool.query(
+ `SELECT 1 FROM information_schema.columns
+ WHERE table_schema = $1 AND table_name = $2 AND column_name = $3`,
+ [schema, table, column],
+ );
+ return rows.length > 0;
+}
+
+async function main() {
+ if (!process.env.DATABASE_URL) {
+ console.error("DATABASE_URL is not set");
+ process.exit(1);
+ }
+
+ const pool = new Pool({ connectionString: process.env.DATABASE_URL });
+
+ try {
+ if (!(await tableExists(pool, "auth.users"))) {
+ console.log("auth.users does not exist — nothing to migrate");
+ return;
+ }
+
+ const hasIdentities = await tableExists(pool, "auth.identities");
+ // GoTrue added identities.provider_id (the provider's user id) in newer
+ // versions; older schemas only carry it inside identity_data->>'sub'.
+ const providerAccountIdExpr =
+ hasIdentities &&
+ (await columnExists(pool, "auth", "identities", "provider_id"))
+ ? "COALESCE(i.provider_id::text, i.identity_data->>'sub', i.user_id::text)"
+ : "COALESCE(i.identity_data->>'sub', i.user_id::text)";
+
+ const { rows: totals } = await pool.query<{ n: string }>(
+ "SELECT count(*)::text AS n FROM auth.users",
+ );
+ console.log(`auth.users rows: ${totals[0].n}`);
+
+ let lastId = "00000000-0000-0000-0000-000000000000";
+ let processed = 0;
+ let usersInserted = 0;
+ let credentialAccounts = 0;
+ let oauthAccounts = 0;
+
+ for (;;) {
+ const { rows: batch } = await pool.query<{ id: string }>(
+ "SELECT id::text FROM auth.users WHERE id > $1::uuid ORDER BY id LIMIT $2",
+ [lastId, BATCH_SIZE],
+ );
+ if (batch.length === 0) break;
+
+ const ids = batch.map((r) => r.id);
+ lastId = ids[ids.length - 1];
+
+ const client = await pool.connect();
+ try {
+ await client.query("BEGIN");
+
+ // 1) auth.users -> platform."UserAuthIdentity". Skip deleted users and rows
+ // without an email. The NOT EXISTS email guard skips users whose
+ // email is already taken by a different Better Auth user instead
+ // of failing the whole batch on the unique(email) index.
+ const userRes = await client.query(
+ `INSERT INTO platform."UserAuthIdentity"
+ (id, name, email, "emailVerified", role, banned, "preferredName",
+ "createdAt", "updatedAt")
+ SELECT
+ u.id::text,
+ COALESCE(
+ u.raw_user_meta_data->>'name',
+ u.raw_user_meta_data->>'full_name',
+ split_part(u.email, '@', 1)
+ ),
+ u.email,
+ (u.email_confirmed_at IS NOT NULL),
+ CASE
+ WHEN COALESCE(u.is_super_admin, false) OR u.role = 'admin'
+ THEN 'admin' ELSE 'user'
+ END,
+ (u.banned_until IS NOT NULL AND u.banned_until > now()),
+ u.raw_user_meta_data->>'preferred_name',
+ COALESCE(u.created_at, now()),
+ COALESCE(u.updated_at, now())
+ FROM auth.users u
+ WHERE u.id = ANY($1::uuid[])
+ AND u.email IS NOT NULL
+ AND u.deleted_at IS NULL
+ AND NOT EXISTS (
+ SELECT 1 FROM platform."UserAuthIdentity" pu
+ WHERE pu.email = u.email AND pu.id <> u.id::text
+ )
+ ON CONFLICT (id) DO NOTHING`,
+ [ids],
+ );
+
+ // 2) Email/password credentials -> platform."UserAuthAccount".
+ const credRes = await client.query(
+ `INSERT INTO platform."UserAuthAccount"
+ (id, "accountId", "providerId", "userId", password, "createdAt", "updatedAt")
+ SELECT
+ gen_random_uuid()::text,
+ u.id::text,
+ 'credential',
+ u.id::text,
+ u.encrypted_password,
+ COALESCE(u.created_at, now()),
+ COALESCE(u.updated_at, now())
+ FROM auth.users u
+ WHERE u.id = ANY($1::uuid[])
+ AND u.encrypted_password IS NOT NULL
+ AND length(u.encrypted_password) > 0
+ AND EXISTS (
+ SELECT 1 FROM platform."UserAuthIdentity" pu WHERE pu.id = u.id::text
+ )
+ AND NOT EXISTS (
+ SELECT 1 FROM platform."UserAuthAccount" a
+ WHERE a."userId" = u.id::text AND a."providerId" = 'credential'
+ )`,
+ [ids],
+ );
+
+ // 3) OAuth identities -> platform."UserAuthAccount". provider 'email' is the
+ // GoTrue-internal credential identity and is skipped (handled
+ // above); only providers Better Auth is configured for migrate.
+ let oauthRes = { rowCount: 0 as number | null };
+ if (hasIdentities) {
+ oauthRes = await client.query(
+ `INSERT INTO platform."UserAuthAccount"
+ (id, "accountId", "providerId", "userId", "createdAt", "updatedAt")
+ SELECT
+ gen_random_uuid()::text,
+ ${providerAccountIdExpr},
+ i.provider,
+ i.user_id::text,
+ COALESCE(i.created_at, now()),
+ COALESCE(i.updated_at, now())
+ FROM auth.identities i
+ WHERE i.user_id = ANY($1::uuid[])
+ AND i.provider IN ('google', 'github', 'discord')
+ AND EXISTS (
+ SELECT 1 FROM platform."UserAuthIdentity" pu WHERE pu.id = i.user_id::text
+ )
+ AND NOT EXISTS (
+ SELECT 1 FROM platform."UserAuthAccount" a
+ WHERE a."userId" = i.user_id::text AND a."providerId" = i.provider
+ )`,
+ [ids],
+ );
+ }
+
+ await client.query("COMMIT");
+
+ processed += ids.length;
+ usersInserted += userRes.rowCount ?? 0;
+ credentialAccounts += credRes.rowCount ?? 0;
+ oauthAccounts += oauthRes.rowCount ?? 0;
+ console.log(
+ `processed ${processed} users ` +
+ `(+${userRes.rowCount ?? 0} users, ` +
+ `+${credRes.rowCount ?? 0} credential accounts, ` +
+ `+${oauthRes.rowCount ?? 0} oauth accounts)`,
+ );
+ } catch (error) {
+ await client.query("ROLLBACK").catch(() => {});
+ throw error;
+ } finally {
+ client.release();
+ }
+ }
+
+ console.log(
+ `done: ${processed} auth.users processed, ` +
+ `${usersInserted} users migrated, ` +
+ `${credentialAccounts} credential accounts, ` +
+ `${oauthAccounts} oauth accounts`,
+ );
+ } finally {
+ await pool.end();
+ }
+}
+
+main().catch((error) => {
+ console.error("migration failed:", error);
+ process.exit(1);
+});
diff --git a/autogpt_platform/frontend/src/__tests__/middleware.test.ts b/autogpt_platform/frontend/src/__tests__/middleware.test.ts
index 2c7e9af980..6d60e5dc7d 100644
--- a/autogpt_platform/frontend/src/__tests__/middleware.test.ts
+++ b/autogpt_platform/frontend/src/__tests__/middleware.test.ts
@@ -1,10 +1,10 @@
import { describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
-const updateSessionMock = vi.fn();
+const authMiddlewareMock = vi.fn();
-vi.mock("@/lib/supabase/middleware", () => ({
- updateSession: (...args: unknown[]) => updateSessionMock(...args),
+vi.mock("@/lib/auth/middleware", () => ({
+ authMiddleware: (...args: unknown[]) => authMiddlewareMock(...args),
}));
import { middleware } from "../middleware";
@@ -20,7 +20,7 @@ describe("middleware www→non-www redirect", () => {
expect(response.headers.get("location")).toBe(
"https://example.com/dashboard",
);
- expect(updateSessionMock).not.toHaveBeenCalled();
+ expect(authMiddlewareMock).not.toHaveBeenCalled();
});
it("treats uppercase WWW host as case-insensitive (URL API normalizes)", async () => {
@@ -34,14 +34,14 @@ describe("middleware www→non-www redirect", () => {
);
});
- it("falls through to updateSession when host is non-www", async () => {
+ it("falls through to authMiddleware when host is non-www", async () => {
const passthrough = new Response("ok");
- updateSessionMock.mockResolvedValueOnce(passthrough);
+ authMiddlewareMock.mockResolvedValueOnce(passthrough);
const request = new NextRequest("https://example.com/dashboard");
const response = await middleware(request);
- expect(updateSessionMock).toHaveBeenCalledTimes(1);
+ expect(authMiddlewareMock).toHaveBeenCalledTimes(1);
expect(response).toBe(passthrough);
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
index d9fb00e2c0..dccb8a6860 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/__tests__/page.test.tsx
@@ -19,7 +19,7 @@ import PlatformLinkPage from "../page";
const mockUseParams = vi.hoisted(() => vi.fn());
const mockUseSearchParams = vi.hoisted(() => vi.fn());
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
const mockLogOut = vi.hoisted(() => vi.fn());
vi.mock("next/navigation", () => ({
@@ -36,12 +36,12 @@ vi.mock("next/navigation", () => ({
useSearchParams: mockUseSearchParams,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
function authenticate() {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: {
id: "user-1",
@@ -53,7 +53,6 @@ function authenticate() {
isLoggedIn: true,
isUserLoading: false,
logOut: mockLogOut,
- supabase: {},
});
}
@@ -95,12 +94,11 @@ describe("PlatformLinkPage", () => {
test("asks unauthenticated users to sign in without fetching link info", () => {
const infoHandler = vi.fn();
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: null,
isLoggedIn: false,
isUserLoading: false,
logOut: mockLogOut,
- supabase: {},
});
server.use(
getGetPlatformLinkingGetDisplayInfoForALinkTokenMockHandler200(() => {
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
index 36770f5351..e939dc5aaf 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/link/[token]/usePlatformLinkingPage.ts
@@ -6,7 +6,7 @@ import {
import { ConfirmLinkResponse } from "@/app/api/__generated__/models/confirmLinkResponse";
import { ConfirmUserLinkResponse } from "@/app/api/__generated__/models/confirmUserLinkResponse";
import { LinkType } from "@/app/api/__generated__/models/linkType";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useParams, useSearchParams } from "next/navigation";
import {
getLoginRedirect,
@@ -36,7 +36,7 @@ export function usePlatformLinkingPage() {
const rawToken = (params.token as string | undefined) ?? "";
const token = TOKEN_PATTERN.test(rawToken) ? rawToken : null;
const platformFromUrl = getPlatformDisplayName(searchParams.get("platform"));
- const { user, isUserLoading, logOut } = useSupabase();
+ const { user, isUserLoading, logOut } = useAuth();
const {
data: info,
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/actions.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/actions.test.ts
new file mode 100644
index 0000000000..70b7809e6e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/actions.test.ts
@@ -0,0 +1,143 @@
+import { APIError } from "better-auth/api";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const signInEmailMock = vi.fn();
+const rollbackSessionMock = vi.fn();
+const createUserMock = vi.fn();
+const getOnboardingStatusMock = vi.fn();
+const captureExceptionMock = vi.fn();
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ signInEmail: (...args: unknown[]) => signInEmailMock(...args),
+ },
+ },
+}));
+
+vi.mock("@/lib/auth/server/rollbackSession", () => ({
+ rollbackSession: (...args: unknown[]) => rollbackSessionMock(...args),
+}));
+
+vi.mock("@/lib/autogpt-server-api", () => ({
+ default: class BackendAPIMock {
+ createUser(...args: unknown[]) {
+ return createUserMock(...args);
+ }
+ },
+}));
+
+vi.mock("@/app/api/helpers", () => ({
+ getOnboardingStatus: () => getOnboardingStatusMock(),
+}));
+
+vi.mock("next/headers", () => ({
+ headers: vi.fn(async () => new Headers()),
+}));
+
+vi.mock("@sentry/nextjs", () => ({
+ captureException: (...args: unknown[]) => captureExceptionMock(...args),
+}));
+
+import { login } from "../actions";
+
+beforeEach(() => {
+ signInEmailMock.mockReset();
+ rollbackSessionMock.mockReset();
+ createUserMock.mockReset();
+ getOnboardingStatusMock.mockReset();
+ captureExceptionMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("login", () => {
+ it("signs in, provisions the backend user, and points new users at onboarding", async () => {
+ signInEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ createUserMock.mockResolvedValue({ id: "user-1" });
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: true });
+
+ const result = await login("[email protected]", "hunter2-password");
+
+ expect(signInEmailMock).toHaveBeenCalledWith({
+ body: { email: "[email protected]", password: "hunter2-password" },
+ headers: expect.any(Headers),
+ });
+ expect(createUserMock).toHaveBeenCalledTimes(1);
+ expect(getOnboardingStatusMock).toHaveBeenCalledTimes(1);
+ expect(result).toEqual({ success: true, next: "/onboarding" });
+ });
+
+ it("sends returning users to copilot when onboarding is already complete", async () => {
+ signInEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ createUserMock.mockResolvedValue({ id: "user-1" });
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: false });
+
+ const result = await login("[email protected]", "hunter2-password");
+
+ expect(result).toEqual({ success: true, next: "/copilot" });
+ });
+
+ it("returns the Better Auth error message when sign-in fails with an APIError", async () => {
+ signInEmailMock.mockRejectedValue(
+ new APIError("UNAUTHORIZED", {
+ message: "Invalid credentials",
+ code: "INVALID_EMAIL_OR_PASSWORD",
+ }),
+ );
+
+ const result = await login("[email protected]", "wrong-password");
+
+ expect(result).toEqual({ success: false, error: "Invalid credentials" });
+ expect(createUserMock).not.toHaveBeenCalled();
+ });
+
+ it("falls back to a generic message when the APIError carries no body message", async () => {
+ signInEmailMock.mockRejectedValue(new APIError("UNAUTHORIZED"));
+
+ const result = await login("[email protected]", "wrong-password");
+
+ expect(result).toEqual({
+ success: false,
+ error: "Invalid email or password",
+ });
+ });
+
+ it("rejects a malformed email without calling Better Auth", async () => {
+ const result = await login("not-an-email", "hunter2-password");
+
+ expect(result).toEqual({
+ success: false,
+ error: "Invalid email or password",
+ });
+ expect(signInEmailMock).not.toHaveBeenCalled();
+ });
+
+ it("captures unexpected failures in Sentry and returns a generic login error", async () => {
+ signInEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ createUserMock.mockRejectedValue(new Error("backend unreachable"));
+
+ const result = await login("[email protected]", "hunter2-password");
+
+ expect(captureExceptionMock).toHaveBeenCalledTimes(1);
+ expect(rollbackSessionMock).toHaveBeenCalledTimes(1);
+ expect(result).toEqual({
+ success: false,
+ error: "Failed to login. Please try again.",
+ });
+ });
+
+ it("does not roll back the session when login succeeds end to end", async () => {
+ signInEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ createUserMock.mockResolvedValue({});
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: false });
+
+ const result = await login("[email protected]", "hunter2-password");
+
+ expect(rollbackSessionMock).not.toHaveBeenCalled();
+ expect(result).toEqual({ success: true, next: "/copilot" });
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/auth-redirect.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/auth-redirect.test.tsx
index 8727b32f05..66ae3ffe9b 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/auth-redirect.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/login/__tests__/auth-redirect.test.tsx
@@ -17,9 +17,8 @@ vi.mock("next/navigation", () => ({
}));
let mockIsLoggedIn = true;
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
- supabase: {},
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
user: { id: "u" },
isUserLoading: false,
isLoggedIn: mockIsLoggedIn,
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/login/actions.ts b/autogpt_platform/frontend/src/app/(no-navbar)/login/actions.ts
index e87a6a3532..4038367d1a 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/login/actions.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/login/actions.ts
@@ -1,9 +1,12 @@
"use server";
+import { auth } from "@/lib/auth/auth";
+import { rollbackSession } from "@/lib/auth/server/rollbackSession";
import BackendAPI from "@/lib/autogpt-server-api";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
import { loginFormSchema } from "@/types/auth";
import * as Sentry from "@sentry/nextjs";
+import { APIError } from "better-auth/api";
+import { headers } from "next/headers";
import { getOnboardingStatus } from "../../api/helpers";
export async function login(email: string, password: string) {
@@ -17,25 +20,34 @@ export async function login(email: string, password: string) {
};
}
- const supabase = await getServerSupabase();
- if (!supabase) {
- return {
- success: false,
- error: "Authentication service unavailable",
- };
+ try {
+ await auth.api.signInEmail({
+ body: {
+ email: parsed.data.email,
+ password: parsed.data.password,
+ },
+ headers: await headers(),
+ });
+ } catch (error) {
+ if (error instanceof APIError) {
+ return {
+ success: false,
+ error: error.body?.message || "Invalid email or password",
+ };
+ }
+ throw error;
}
- const { error } = await supabase.auth.signInWithPassword(parsed.data);
- if (error) {
- return {
- success: false,
- error: error.message,
- };
+ try {
+ const api = new BackendAPI();
+ await api.createUser();
+ } catch (createUserError) {
+ // The session cookie is already set; revoke it so the browser's auth
+ // state matches the failure the UI is about to show.
+ await rollbackSession();
+ throw createUserError;
}
- const api = new BackendAPI();
- await api.createUser();
-
const { shouldShowOnboarding } = await getOnboardingStatus();
return {
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/login/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/login/page.tsx
index d0908e112d..4492b79c3d 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/login/page.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/login/page.tsx
@@ -34,7 +34,6 @@ export default function LoginPage() {
isCloudEnv,
isUserLoading,
showNotAllowedModal,
- isSupabaseAvailable,
handleSubmit,
handleProviderLogin,
handleCloseNotAllowedModal,
@@ -44,16 +43,6 @@ export default function LoginPage() {
return <LoadingLogin />;
}
- if (!isSupabaseAvailable) {
- return (
- <AuthSplitLayout marketing={<LoginMarketingPanel />}>
- <Text variant="body-medium" className="text-center !text-slate-500">
- User accounts are disabled because Supabase client is unavailable
- </Text>
- </AuthSplitLayout>
- );
- }
-
return (
<AuthSplitLayout marketing={<LoginMarketingPanel />}>
<div className="mb-8">
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/login/useLoginPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/login/useLoginPage.ts
index 059b6830d7..700e9808ea 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/login/useLoginPage.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/login/useLoginPage.ts
@@ -1,7 +1,7 @@
import { useToast } from "@/components/molecules/Toast/use-toast";
import { useCaptureMarketingPrompt } from "@/hooks/useCaptureMarketingPrompt";
import { sanitizeAuthNext } from "@/lib/auth-redirect";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { environment } from "@/services/environment";
import { loginFormSchema, LoginProvider } from "@/types/auth";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -14,7 +14,7 @@ import { login as loginAction } from "./actions";
export function useLoginPage() {
useCaptureMarketingPrompt();
- const { supabase, user, isUserLoading, isLoggedIn } = useSupabase();
+ const { user, isUserLoading, isLoggedIn } = useAuth();
const [feedback, setFeedback] = useState<string | null>(null);
const router = useRouter();
const searchParams = useSearchParams();
@@ -59,7 +59,7 @@ export function useLoginPage() {
: `/auth/callback`;
const fullCallbackUrl = `${window.location.origin}${callbackUrl}`;
- const response = await fetch("/api/auth/provider", {
+ const response = await fetch("/api/auth/login/with-provider", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ provider, redirectTo: fullCallbackUrl }),
@@ -131,7 +131,6 @@ export function useLoginPage() {
isCloudEnv,
isUserLoading,
showNotAllowedModal,
- isSupabaseAvailable: !!supabase,
handleSubmit: form.handleSubmit(handleLogin),
handleProviderLogin,
handleCloseNotAllowedModal: () => setShowNotAllowedModal(false),
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/logout/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/logout/page.tsx
index ef3dc03f1a..595e9b7f0b 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/logout/page.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/logout/page.tsx
@@ -3,7 +3,7 @@
import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";
import { Text } from "@/components/atoms/Text/Text";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useRouter } from "next/navigation";
import { useEffect, useRef } from "react";
@@ -16,7 +16,7 @@ function wait(ms: number): Promise<void> {
}
export default function LogoutPage() {
- const { logOut } = useSupabase();
+ const { logOut } = useAuth();
const { toast } = useToast();
const router = useRouter();
const hasStartedRef = useRef(false);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
index 4b3667bd29..2e0642fdf9 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/page.test.tsx
@@ -40,19 +40,19 @@ vi.mock("next/navigation", () => ({
usePathname: () => "/onboarding",
}));
-let mockSupabaseState = { isLoggedIn: true, isUserLoading: false };
+let mockAuthState = { isLoggedIn: true, isUserLoading: false };
const mockRefreshSession = vi.fn(() => Promise.resolve({ user: null }));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
- ...mockSupabaseState,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
+ ...mockAuthState,
user: null,
refreshSession: mockRefreshSession,
}),
}));
-// The onboarding page writes preferred_name through the server route (the
-// browser Supabase client has no session — persistSession: false — so
-// client-side auth.updateUser silently fails; regression caught in manual QA).
+// The onboarding page writes preferred_name through the server route,
+// which is the only holder of the Better Auth session cookie context
+// (client-side updateUser was a silent no-op; regression caught in manual QA).
const authUserPutBodies: unknown[] = [];
function mockAuthUserRoute() {
server.use(
@@ -108,7 +108,7 @@ beforeEach(() => {
currentSearchParams = new URLSearchParams();
mockFlagValue = false;
mockSubscriptionTier = "NO_TIER";
- mockSupabaseState = { isLoggedIn: true, isUserLoading: false };
+ mockAuthState = { isLoggedIn: true, isUserLoading: false };
authUserPutBodies.length = 0;
mockAuthUserRoute();
mockRefreshSession.mockClear();
@@ -266,7 +266,7 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
expect(screen.queryByTestId("step-preparing")).toBeNull();
});
- it("waits for Supabase auth before initialising (no premature step lock)", async () => {
+ it("waits for auth before initialising (no premature step lock)", async () => {
// Regression: LD can resolve while auth is still loading. Without
// gating on isUserLoading, isReady flips true (the !isLoggedIn branch
// short-circuits), init runs against the pre-tier preparingStep (5)
@@ -276,7 +276,7 @@ describe("OnboardingPage — flag-gated SubscriptionStep", () => {
// no matching step guard (blank page).
mockFlagValue = true;
mockSubscriptionTier = "PRO";
- mockSupabaseState = { isLoggedIn: false, isUserLoading: true };
+ mockAuthState = { isLoggedIn: false, isUserLoading: true };
window.sessionStorage.setItem(STEP_STORAGE_KEY, "5");
render(<OnboardingPage />);
// Nothing should render while auth is still loading.
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
index 758c163986..a7a32f4389 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts
@@ -6,7 +6,7 @@ import {
} from "@/app/api/__generated__/endpoints/onboarding/onboarding";
import type { SubscriptionStatusResponse } from "@/app/api/__generated__/models/subscriptionStatusResponse";
import { resolveResponse } from "@/app/api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { environment } from "@/services/environment";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { useLDClient } from "launchdarkly-react-client-sdk";
@@ -54,7 +54,7 @@ function clearHighestStep() {
export function useOnboardingPage() {
const router = useRouter();
const searchParams = useSearchParams();
- const { isLoggedIn, isUserLoading, refreshSession } = useSupabase();
+ const { isLoggedIn, isUserLoading, refreshSession } = useAuth();
const currentStep = useOnboardingWizardStore((s) => s.currentStep);
const goToStep = useOnboardingWizardStore((s) => s.goToStep);
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/ShareActions.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/ShareActions.tsx
index 56b5b55a6f..d845707d00 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/ShareActions.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/ShareActions.tsx
@@ -4,7 +4,7 @@ import { useState } from "react";
import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
import { Button } from "@/components/atoms/Button/Button";
import { toast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
// Renders the right-slot CTAs on every ``/share/...`` viewer:
//
@@ -19,7 +19,7 @@ import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
// and chat) plug into the same header. Keeping the CTAs in one
// component means a future addition lands in one place.
export function ShareActions() {
- const { isLoggedIn, isUserLoading } = useSupabase();
+ const { isLoggedIn, isUserLoading } = useAuth();
const [copied, setCopied] = useState(false);
async function handleCopy() {
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/__tests__/ShareActions.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/__tests__/ShareActions.test.tsx
index b33916ca27..b67af1ddb7 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/__tests__/ShareActions.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/share/components/ShareHeader/__tests__/ShareActions.test.tsx
@@ -8,10 +8,10 @@ import {
} from "@/tests/integrations/test-utils";
import { ShareActions } from "../ShareActions";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
// Clipboard isn't available in jsdom by default; defineProperty so
@@ -28,7 +28,7 @@ beforeEach(() => {
value: new URL("http://localhost/share/chat/some-token"),
});
clipboardWrite.mockClear();
- mockUseSupabase.mockReset();
+ mockUseAuth.mockReset();
});
afterEach(() => {
@@ -37,7 +37,7 @@ afterEach(() => {
describe("ShareActions", () => {
test("renders Sign up CTA when the viewer is anonymous", () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
isLoggedIn: false,
isUserLoading: false,
});
@@ -49,7 +49,7 @@ describe("ShareActions", () => {
});
test("hides Sign up CTA when the viewer is signed in", () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
isLoggedIn: true,
isUserLoading: false,
});
@@ -60,10 +60,10 @@ describe("ShareActions", () => {
});
test("hides Sign up CTA while auth state is still loading", () => {
- // First paint after navigation: useSupabase hasn't initialised yet.
+ // First paint after navigation: useAuth hasn't initialised yet.
// Showing then hiding the CTA on hydration looks broken to a
// signed-in viewer opening their own share, so we suppress it.
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
isLoggedIn: false,
isUserLoading: true,
});
@@ -76,7 +76,7 @@ describe("ShareActions", () => {
});
test("clicking Copy link writes the current URL to the clipboard", async () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
isLoggedIn: false,
isUserLoading: false,
});
@@ -97,7 +97,7 @@ describe("ShareActions", () => {
});
test("clipboard failure leaves the button on 'Copy link' and does not flash 'Copied'", async () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
isLoggedIn: false,
isUserLoading: false,
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/actions.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/actions.test.ts
index 5ae1f49fbb..38de41e9ef 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/actions.test.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/actions.test.ts
@@ -4,7 +4,8 @@ import { signup } from "../actions";
const mocks = vi.hoisted(() => ({
captureException: vi.fn(),
getOnboardingStatus: vi.fn(),
- getServerSupabase: vi.fn(),
+ signUpEmail: vi.fn(),
+ rollbackSession: vi.fn(),
postV1GetOrCreateUser: vi.fn(),
scheduleAccountCreatedGoal: vi.fn(),
}));
@@ -15,8 +16,14 @@ vi.mock("@/app/api/__generated__/endpoints/auth/auth", () => ({
vi.mock("@/app/api/helpers", () => ({
getOnboardingStatus: mocks.getOnboardingStatus,
}));
-vi.mock("@/lib/supabase/server/getServerSupabase", () => ({
- getServerSupabase: mocks.getServerSupabase,
+vi.mock("@/lib/auth/auth", () => ({
+ auth: { api: { signUpEmail: mocks.signUpEmail } },
+}));
+vi.mock("@/lib/auth/server/rollbackSession", () => ({
+ rollbackSession: mocks.rollbackSession,
+}));
+vi.mock("next/headers", () => ({
+ headers: vi.fn().mockResolvedValue(new Headers()),
}));
vi.mock("@/services/analytics/datafast-server", async (importOriginal) => {
const actual =
@@ -35,15 +42,9 @@ vi.mock("@sentry/nextjs", () => ({
describe("email signup account creation tracking", () => {
beforeEach(() => {
vi.clearAllMocks();
- mocks.getServerSupabase.mockResolvedValue({
- auth: {
- signUp: vi.fn().mockResolvedValue({
- data: { session: { access_token: "token" } },
- error: null,
- }),
- setSession: vi.fn().mockResolvedValue(undefined),
- },
- });
+ // Better Auth's signUpEmail sets the session cookie; a resolved call is
+ // the success case.
+ mocks.signUpEmail.mockResolvedValue({});
mocks.getOnboardingStatus.mockResolvedValue({
shouldShowOnboarding: true,
});
@@ -86,12 +87,10 @@ describe("email signup account creation tracking", () => {
expect(mocks.scheduleAccountCreatedGoal).not.toHaveBeenCalled();
});
- it("reports a resolved backend error instead of completing signup", async () => {
- mocks.postV1GetOrCreateUser.mockResolvedValue({
- status: 500,
- data: {},
- headers: new Headers(),
- });
+ it("reports a thrown backend error instead of completing signup", async () => {
+ // The generated client throws ApiError on non-2xx (custom-mutator), which
+ // the action catches to roll back the session and surface the failure.
+ mocks.postV1GetOrCreateUser.mockRejectedValue({ status: 500 });
const result = await signup(
@@ -102,6 +101,10 @@ describe("email signup account creation tracking", () => {
expect(result.success).toBe(false);
expect(mocks.captureException).toHaveBeenCalledOnce();
+ // Revoking the session on provisioning failure is the security-relevant
+ // behavior — without it the browser stays authenticated after a failed
+ // account setup.
+ expect(mocks.rollbackSession).toHaveBeenCalledOnce();
expect(mocks.scheduleAccountCreatedGoal).not.toHaveBeenCalled();
});
});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/auth-redirect.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/auth-redirect.test.tsx
index 4acf0dcf16..4b7f6ef047 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/auth-redirect.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/auth-redirect.test.tsx
@@ -17,9 +17,8 @@ vi.mock("next/navigation", () => ({
}));
let mockIsLoggedIn = true;
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
- supabase: {},
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
user: { id: "u" },
isUserLoading: false,
isLoggedIn: mockIsLoggedIn,
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/page.test.tsx
index 4ac1e3dc50..3603a5bc08 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/page.test.tsx
@@ -8,15 +8,15 @@ import {
import SignupPage from "../page";
import { beforeEach, describe, expect, test, vi } from "vitest";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
const mockSignupAction = vi.hoisted(() => vi.fn());
vi.mock("@/providers/onboarding/onboarding-provider", () => ({
default: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("../actions", () => ({
@@ -25,8 +25,7 @@ vi.mock("../actions", () => ({
describe("SignupPage", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
- supabase: {},
+ mockUseAuth.mockReturnValue({
user: null,
isUserLoading: false,
isLoggedIn: false,
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/signup-action.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/signup-action.test.ts
new file mode 100644
index 0000000000..be51e5d523
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/__tests__/signup-action.test.ts
@@ -0,0 +1,179 @@
+import { APIError } from "better-auth/api";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const signUpEmailMock = vi.fn();
+const rollbackSessionMock = vi.fn();
+const postV1GetOrCreateUserMock = vi.fn();
+const getOnboardingStatusMock = vi.fn();
+const isWaitlistErrorMock = vi.fn();
+const logWaitlistErrorMock = vi.fn();
+const captureExceptionMock = vi.fn();
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ signUpEmail: (...args: unknown[]) => signUpEmailMock(...args),
+ },
+ },
+}));
+
+vi.mock("@/lib/auth/server/rollbackSession", () => ({
+ rollbackSession: (...args: unknown[]) => rollbackSessionMock(...args),
+}));
+
+vi.mock("@/app/api/__generated__/endpoints/auth/auth", () => ({
+ postV1GetOrCreateUser: (...args: unknown[]) =>
+ postV1GetOrCreateUserMock(...args),
+}));
+
+// DataFast account tracking is exercised by actions.test.ts; stub it here so
+// wasAccountCreated doesn't read .headers off the minimal mocked response.
+vi.mock("@/services/analytics/datafast-server", () => ({
+ wasAccountCreated: () => false,
+ scheduleAccountCreatedGoal: vi.fn(),
+}));
+
+vi.mock("@/app/api/helpers", async (importActual) => {
+ const actual = await importActual<typeof import("@/app/api/helpers")>();
+ return {
+ ...actual,
+ getOnboardingStatus: () => getOnboardingStatusMock(),
+ };
+});
+
+vi.mock("@/app/api/auth/utils", () => ({
+ isWaitlistError: (...args: unknown[]) => isWaitlistErrorMock(...args),
+ logWaitlistError: (...args: unknown[]) => logWaitlistErrorMock(...args),
+}));
+
+vi.mock("next/headers", () => ({
+ headers: vi.fn(async () => new Headers()),
+}));
+
+vi.mock("@sentry/nextjs", () => ({
+ captureException: (...args: unknown[]) => captureExceptionMock(...args),
+}));
+
+import { signup } from "../actions";
+
+const email = "[email protected]";
+const validPassword = "a-long-enough-password";
+
+function signupWithValidPayload() {
+ return signup(email, validPassword, validPassword, true);
+}
+
+beforeEach(() => {
+ signUpEmailMock.mockReset();
+ rollbackSessionMock.mockReset();
+ postV1GetOrCreateUserMock.mockReset();
+ getOnboardingStatusMock.mockReset();
+ isWaitlistErrorMock.mockReset().mockReturnValue(false);
+ logWaitlistErrorMock.mockReset();
+ captureExceptionMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("signup", () => {
+ it("creates the account, provisions the backend user, and routes to onboarding", async () => {
+ signUpEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ postV1GetOrCreateUserMock.mockResolvedValue({
+ status: 200,
+ data: { id: "user-1" },
+ });
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: true });
+
+ const result = await signupWithValidPayload();
+
+ expect(signUpEmailMock).toHaveBeenCalledWith({
+ body: { email, password: validPassword, name: "new.user" },
+ headers: expect.any(Headers),
+ });
+ expect(postV1GetOrCreateUserMock).toHaveBeenCalledTimes(1);
+ expect(result).toEqual({ success: true, next: "/onboarding" });
+ });
+
+ it("routes straight to copilot when onboarding is already complete", async () => {
+ signUpEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ postV1GetOrCreateUserMock.mockResolvedValue({
+ status: 200,
+ data: { id: "user-1" },
+ });
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: false });
+
+ const result = await signupWithValidPayload();
+
+ expect(result).toEqual({ success: true, next: "/copilot" });
+ });
+
+ it("reports user_already_exists when Better Auth rejects a duplicate email", async () => {
+ // Better Auth's email sign-up throws USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL.
+ signUpEmailMock.mockRejectedValue(
+ new APIError("UNPROCESSABLE_ENTITY", {
+ message: "User already exists. Use another email.",
+ code: "USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL",
+ }),
+ );
+
+ const result = await signupWithValidPayload();
+
+ expect(result).toEqual({ success: false, error: "user_already_exists" });
+ expect(postV1GetOrCreateUserMock).not.toHaveBeenCalled();
+ });
+
+ it("reports not_allowed when the failure is a waitlist rejection", async () => {
+ isWaitlistErrorMock.mockReturnValue(true);
+ signUpEmailMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: 'The email address "[email]" is not allowed to register.',
+ code: "P0001",
+ }),
+ );
+
+ const result = await signupWithValidPayload();
+
+ expect(result).toEqual({ success: false, error: "not_allowed" });
+ expect(logWaitlistErrorMock).toHaveBeenCalledWith(
+ "Signup",
+ expect.any(String),
+ );
+ });
+
+ it("surfaces the Better Auth message for other APIErrors", async () => {
+ signUpEmailMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: "Password is too weak",
+ code: "WEAK_PASSWORD",
+ }),
+ );
+
+ const result = await signupWithValidPayload();
+
+ expect(result).toEqual({ success: false, error: "Password is too weak" });
+ });
+
+ it("asks the user to retry when backend user provisioning fails after sign-up", async () => {
+ signUpEmailMock.mockResolvedValue({ user: { id: "user-1" } });
+ postV1GetOrCreateUserMock.mockRejectedValue(new Error("backend down"));
+
+ const result = await signupWithValidPayload();
+
+ expect(captureExceptionMock).toHaveBeenCalledTimes(1);
+ expect(rollbackSessionMock).toHaveBeenCalledTimes(1);
+ expect(result).toEqual({
+ success: false,
+ error: "Failed to complete account setup. Please try again.",
+ });
+ });
+
+ it("rejects a password shorter than 12 characters without calling Better Auth", async () => {
+ const result = await signup(email, "short-pass", "short-pass", true);
+
+ expect(result).toEqual({ success: false, error: "Invalid signup payload" });
+ expect(signUpEmailMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/actions.ts b/autogpt_platform/frontend/src/app/(no-navbar)/signup/actions.ts
index 255ea3763a..ab9ffd1b2d 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/actions.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/actions.ts
@@ -2,13 +2,16 @@
import { postV1GetOrCreateUser } from "@/app/api/__generated__/endpoints/auth/auth";
import { getOnboardingStatus } from "@/app/api/helpers";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
+import { auth } from "@/lib/auth/auth";
+import { rollbackSession } from "@/lib/auth/server/rollbackSession";
import {
scheduleAccountCreatedGoal,
wasAccountCreated,
} from "@/services/analytics/datafast-server";
import { signupFormSchema } from "@/types/auth";
import * as Sentry from "@sentry/nextjs";
+import { APIError } from "better-auth/api";
+import { headers } from "next/headers";
import { isWaitlistError, logWaitlistError } from "../../api/auth/utils";
export async function signup(
@@ -32,34 +35,42 @@ export async function signup(
};
}
- const supabase = await getServerSupabase();
- if (!supabase) {
- return {
- success: false,
- error: "Authentication service unavailable",
- };
- }
-
- const { data, error } = await supabase.auth.signUp(parsed.data);
+ try {
+ // The session cookie is set automatically by the nextCookies plugin.
+ await auth.api.signUpEmail({
+ body: {
+ email: parsed.data.email,
+ password: parsed.data.password,
+ name: parsed.data.email.split("@")[0],
+ },
+ headers: await headers(),
+ });
+ } catch (error) {
+ if (error instanceof APIError) {
+ // Match on the body message ("Signups are not allowed."), not
+ // error.message — the latter is the status ("FORBIDDEN"), which never
+ // matches the waitlist patterns, so rejections would slip through as a
+ // generic error.
+ if (isWaitlistError(error.body?.code, error.body?.message)) {
+ logWaitlistError("Signup", error.message);
+ return { success: false, error: "not_allowed" };
+ }
- if (error) {
- if (isWaitlistError(error?.code, error?.message)) {
- logWaitlistError("Signup", error.message);
- return { success: false, error: "not_allowed" };
- }
+ // Better Auth's email sign-up throws USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL;
+ // accept the legacy code too in case the adapter version changes.
+ if (
+ error.body?.code === "USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL" ||
+ error.body?.code === "USER_ALREADY_EXISTS"
+ ) {
+ return { success: false, error: "user_already_exists" };
+ }
- if ((error as any).code === "user_already_exists") {
- return { success: false, error: "user_already_exists" };
+ return {
+ success: false,
+ error: error.body?.message || error.message,
+ };
}
-
- return {
- success: false,
- error: error.message,
- };
- }
-
- if (data.session) {
- await supabase.auth.setSession(data.session);
+ throw error;
}
try {
@@ -70,6 +81,9 @@ export async function signup(
} catch (createUserError) {
console.error("Error creating user during signup:", createUserError);
Sentry.captureException(createUserError);
+ // The session cookie is already set; revoke it so the browser's auth
+ // state matches the failure the UI is about to show.
+ await rollbackSession();
return {
success: false,
error: "Failed to complete account setup. Please try again.",
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/signup/page.tsx
index cfc2d62114..518b3258c5 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/page.tsx
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/page.tsx
@@ -47,7 +47,6 @@ export default function SignupPage() {
isCloudEnv,
isUserLoading,
showNotAllowedModal,
- isSupabaseAvailable,
handleSubmit,
handleProviderSignup,
handleCloseNotAllowedModal,
@@ -57,16 +56,6 @@ export default function SignupPage() {
return <LoadingSignup />;
}
- if (!isSupabaseAvailable) {
- return (
- <AuthSplitLayout marketing={<SignupMarketingPanel />}>
- <Text variant="body-medium" className="text-center !text-slate-500">
- User accounts are disabled because Supabase client is unavailable
- </Text>
- </AuthSplitLayout>
- );
- }
-
const confirmPasswordError = form.formState.errors.confirmPassword?.message;
const termsError = form.formState.errors.agreeToTerms?.message;
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/signup/useSignupPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/signup/useSignupPage.ts
index 57dd0126ba..79b2ff6277 100644
--- a/autogpt_platform/frontend/src/app/(no-navbar)/signup/useSignupPage.ts
+++ b/autogpt_platform/frontend/src/app/(no-navbar)/signup/useSignupPage.ts
@@ -1,7 +1,7 @@
import { useToast } from "@/components/molecules/Toast/use-toast";
import { useCaptureMarketingPrompt } from "@/hooks/useCaptureMarketingPrompt";
import { sanitizeAuthNext } from "@/lib/auth-redirect";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { environment } from "@/services/environment";
import { LoginProvider, signupFormSchema } from "@/types/auth";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -14,7 +14,7 @@ import { signup as signupAction } from "./actions";
export function useSignupPage() {
useCaptureMarketingPrompt();
- const { supabase, user, isUserLoading, isLoggedIn } = useSupabase();
+ const { user, isUserLoading, isLoggedIn } = useAuth();
const [feedback, setFeedback] = useState<string | null>(null);
const { toast } = useToast();
const router = useRouter();
@@ -61,7 +61,7 @@ export function useSignupPage() {
: `/auth/callback`;
const fullCallbackUrl = `${window.location.origin}${callbackUrl}`;
- const response = await fetch("/api/auth/provider", {
+ const response = await fetch("/api/auth/login/with-provider", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ provider, redirectTo: fullCallbackUrl }),
@@ -165,7 +165,6 @@ export function useSignupPage() {
isCloudEnv,
isUserLoading,
showNotAllowedModal,
- isSupabaseAvailable: !!supabase,
handleSubmit: form.handleSubmit(handleSignup),
handleCloseNotAllowedModal: () => setShowNotAllowedModal(false),
handleProviderSignup,
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
index 8fa73d13aa..43ac443cb7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallGate.tsx
@@ -5,7 +5,7 @@ import { usePathname } from "next/navigation";
import { useGetSubscriptionStatus } from "@/app/api/__generated__/endpoints/credits/credits";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { environment } from "@/services/environment";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { PaywallModal } from "./PaywallModal";
// Routes that bypass the paywall regardless of subscription state — primarily
@@ -26,7 +26,7 @@ const PAYWALL_EXEMPT_PREFIXES = [
export function PaywallGate({ children }: { children: ReactNode }) {
const pathname = usePathname();
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
const isPaymentEnabled = useGetFlag(Flag.ENABLE_PLATFORM_PAYMENT);
const { data: subscription, isLoading } = useGetSubscriptionStatus({
query: {
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx
index 82fa992e32..0230860ef5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallGate.test.tsx
@@ -10,8 +10,8 @@ vi.mock("next/navigation", () => ({
// Mock the auth hook — toggle logged-in vs logged-out per test.
let mockIsLoggedIn = true;
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isLoggedIn: mockIsLoggedIn }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isLoggedIn: mockIsLoggedIn }),
}));
// Mock the LD flag hook — toggle paid-cohort vs beta-cohort per test.
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
index 751476e94b..1dbe5f0544 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
@@ -48,8 +48,8 @@ vi.mock("@/components/molecules/Dialog/Dialog", () => ({
}));
const mockValidateSession = vi.fn().mockResolvedValue(true);
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
validateSession: mockValidateSession,
isLoggedIn: true,
}),
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
index f1fc6c0796..ec75bf55eb 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts
@@ -10,7 +10,7 @@ import type { SubscriptionTierRequestTier } from "@/app/api/__generated__/models
import { toast } from "@/components/molecules/Toast/use-toast";
import { useMountEffect } from "@/hooks/useMountEffect";
import { ApiError } from "@/lib/autogpt-server-api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { COUNTRIES } from "@/components/molecules/PlanCard/countries";
import {
type BackendTierKey,
@@ -63,7 +63,7 @@ export function usePaywallModal() {
query: { select: (res) => (res.status === 200 ? res.data : null) },
});
const { mutateAsync: updateTier, isPending } = useUpdateSubscriptionTier();
- const { validateSession } = useSupabase();
+ const { validateSession } = useAuth();
const router = useRouter();
// The paywall can outlive the session that mounted it (failed logout,
diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts
index 2477b36049..147b75c199 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts
@@ -8,12 +8,12 @@ vi.mock("next/navigation", () => ({
usePathname: () => pathnameMock(),
}));
-const supabaseMock = vi.fn(() => ({
+const authMock = vi.fn(() => ({
isLoggedIn: true,
isUserLoading: false,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => supabaseMock(),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => authMock(),
}));
const flagMock = vi.fn<(flag: string) => boolean>(() => true);
@@ -32,7 +32,7 @@ describe("usePlatformChrome", () => {
beforeEach(() => {
pathnameMock.mockReturnValue("/marketplace");
flagMock.mockReturnValue(true);
- supabaseMock.mockReturnValue({ isLoggedIn: true, isUserLoading: false });
+ authMock.mockReturnValue({ isLoggedIn: true, isUserLoading: false });
});
it("enables the new layout after mount when the flag is on and route is allowed", async () => {
@@ -108,7 +108,7 @@ describe("usePlatformChrome", () => {
});
it("shows the tour sidebar for logged-out marketplace visitors", async () => {
- supabaseMock.mockReturnValue({ isLoggedIn: false, isUserLoading: false });
+ authMock.mockReturnValue({ isLoggedIn: false, isUserLoading: false });
const { result } = renderHook(() => usePlatformChrome());
await waitFor(() => {
@@ -118,7 +118,7 @@ describe("usePlatformChrome", () => {
});
it("keeps the tour sidebar hidden while the session check is in flight", async () => {
- supabaseMock.mockReturnValue({ isLoggedIn: false, isUserLoading: true });
+ authMock.mockReturnValue({ isLoggedIn: false, isUserLoading: true });
const { result } = renderHook(() => usePlatformChrome());
await waitFor(() => {
@@ -136,7 +136,7 @@ describe("usePlatformChrome", () => {
});
it("keeps the tour sidebar off non-marketplace routes when logged out", async () => {
- supabaseMock.mockReturnValue({ isLoggedIn: false, isUserLoading: false });
+ authMock.mockReturnValue({ isLoggedIn: false, isUserLoading: false });
pathnameMock.mockReturnValue("/library");
const { result } = renderHook(() => usePlatformChrome());
diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts
index 4656d4305b..bdafd02ebb 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts
@@ -1,7 +1,7 @@
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { getRouteTitle } from "./components/InsetHeaderTitle/InsetHeaderTitle";
@@ -25,7 +25,7 @@ export function usePlatformChrome() {
const isNewLayoutEnabled = useGetFlag(Flag.AUTOGPT_NEW_LAYOUT);
// Also initializes the auth store — required here because the tour shell
// replaces the Navbar, which is what normally kicks off the session check.
- const { isLoggedIn, isUserLoading } = useSupabase();
+ const { isLoggedIn, isUserLoading } = useAuth();
// The LaunchDarkly flag is client-side data that can resolve differently on
// the server vs the client's first render. Switching the whole layout shell
diff --git a/autogpt_platform/frontend/src/app/(platform)/auth/callback/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/(platform)/auth/callback/__tests__/route.test.ts
new file mode 100644
index 0000000000..2422f33ec8
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/auth/callback/__tests__/route.test.ts
@@ -0,0 +1,274 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const getServerSessionMock = vi.fn();
+const postV1GetOrCreateUserMock = vi.fn();
+const getOnboardingStatusMock = vi.fn();
+const revalidatePathMock = vi.fn();
+const scheduleAccountCreatedGoalMock = vi.fn();
+
+vi.mock("@/lib/auth/server/getServerSession", () => ({
+ getServerSession: () => getServerSessionMock(),
+}));
+
+vi.mock("@/app/api/__generated__/endpoints/auth/auth", () => ({
+ postV1GetOrCreateUser: (...args: unknown[]) =>
+ postV1GetOrCreateUserMock(...args),
+}));
+
+// Keep the real wasAccountCreated (it reads the provisioning response header);
+// only the goal dispatch, which hits cookies and the network, is stubbed.
+vi.mock("@/services/analytics/datafast-server", async (importOriginal) => ({
+ ...(await importOriginal<
+ typeof import("@/services/analytics/datafast-server")
+ >()),
+ scheduleAccountCreatedGoal: (...args: unknown[]) =>
+ scheduleAccountCreatedGoalMock(...args),
+}));
+
+vi.mock("@/app/api/helpers", () => ({
+ getOnboardingStatus: () => getOnboardingStatusMock(),
+}));
+
+vi.mock("next/cache", () => ({
+ revalidatePath: (...args: unknown[]) => revalidatePathMock(...args),
+}));
+
+import { GET } from "../route";
+
+class BackendApiErrorStub extends Error {
+ status: number;
+
+ constructor(message: string, status: number) {
+ super(message);
+ this.name = "BackendApiErrorStub";
+ this.status = status;
+ }
+}
+
+const origin = "http://localhost:3000";
+
+function makeCallbackRequest(
+ path = "/auth/callback",
+ headers: Record<string, string> = {},
+): Request {
+ return new Request(`${origin}${path}`, { headers });
+}
+
+// Shape of the backend provisioning call the route feeds to wasAccountCreated.
+function provisioningResponse(accountCreated = false) {
+ return {
+ status: 200,
+ data: {},
+ headers: new Headers({
+ "X-AutoGPT-User-Created": String(accountCreated),
+ }),
+ };
+}
+
+function loggedInWithCompletedSetup() {
+ getServerSessionMock.mockResolvedValue({ user: { id: "user-1" } });
+ postV1GetOrCreateUserMock.mockResolvedValue(provisioningResponse());
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: false });
+}
+
+beforeEach(() => {
+ getServerSessionMock.mockReset();
+ postV1GetOrCreateUserMock.mockReset();
+ getOnboardingStatusMock.mockReset();
+ revalidatePathMock.mockReset();
+ scheduleAccountCreatedGoalMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+ vi.restoreAllMocks();
+});
+
+describe("auth callback GET — session handling", () => {
+ it("redirects to the auth-code-error page when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.status).toBe(307);
+ expect(response.headers.get("location")).toBe(
+ `${origin}/auth/auth-code-error`,
+ );
+ expect(postV1GetOrCreateUserMock).not.toHaveBeenCalled();
+ });
+
+ it("sends fresh users to onboarding and revalidates the layout", async () => {
+ vi.stubEnv("NODE_ENV", "development");
+ getServerSessionMock.mockResolvedValue({ user: { id: "user-1" } });
+ postV1GetOrCreateUserMock.mockResolvedValue(provisioningResponse());
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: true });
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(`${origin}/onboarding`);
+ expect(revalidatePathMock).toHaveBeenCalledWith("/onboarding", "layout");
+ });
+
+ it("sends already-onboarded users to copilot", async () => {
+ vi.stubEnv("NODE_ENV", "development");
+ loggedInWithCompletedSetup();
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(`${origin}/copilot`);
+ expect(revalidatePathMock).toHaveBeenCalledWith("/copilot", "layout");
+ });
+});
+
+describe("auth callback GET — account creation tracking", () => {
+ beforeEach(() => {
+ vi.stubEnv("NODE_ENV", "development");
+ getServerSessionMock.mockResolvedValue({ user: { id: "user-1" } });
+ getOnboardingStatusMock.mockResolvedValue({ shouldShowOnboarding: false });
+ });
+
+ it("tracks a newly created Google account", async () => {
+ postV1GetOrCreateUserMock.mockResolvedValue(provisioningResponse(true));
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(`${origin}/copilot`);
+ expect(scheduleAccountCreatedGoalMock).toHaveBeenCalledOnce();
+ expect(scheduleAccountCreatedGoalMock).toHaveBeenCalledWith("google");
+ });
+
+ it("does not track a returning Google user", async () => {
+ postV1GetOrCreateUserMock.mockResolvedValue(provisioningResponse(false));
+
+ await GET(makeCallbackRequest());
+
+ expect(scheduleAccountCreatedGoalMock).not.toHaveBeenCalled();
+ });
+});
+
+describe("auth callback GET — redirect target resolution", () => {
+ it("honors the next query parameter in development without consulting x-forwarded-host", async () => {
+ vi.stubEnv("NODE_ENV", "development");
+ loggedInWithCompletedSetup();
+
+ const response = await GET(
+ makeCallbackRequest("/auth/callback?next=/marketplace", {
+ "x-forwarded-host": "app.example.com",
+ }),
+ );
+
+ expect(response.headers.get("location")).toBe(`${origin}/marketplace`);
+ });
+
+ it("redirects through the forwarded host in production", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ loggedInWithCompletedSetup();
+
+ const response = await GET(
+ makeCallbackRequest("/auth/callback?next=/marketplace", {
+ "x-forwarded-host": "app.example.com",
+ }),
+ );
+
+ expect(response.headers.get("location")).toBe(
+ "https://app.example.com/marketplace",
+ );
+ });
+
+ it("falls back to the request origin in production when no forwarded host is set", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ loggedInWithCompletedSetup();
+
+ const response = await GET(
+ makeCallbackRequest("/auth/callback?next=/marketplace"),
+ );
+
+ expect(response.headers.get("location")).toBe(`${origin}/marketplace`);
+ });
+
+ it("ignores an off-site next and cannot open-redirect via the forwarded host", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ loggedInWithCompletedSetup(); // shouldShowOnboarding: false -> /copilot
+
+ for (const evil of ["@evil.com", "//evil.com", "https://evil.com"]) {
+ const response = await GET(
+ makeCallbackRequest(`/auth/callback?next=${encodeURIComponent(evil)}`, {
+ "x-forwarded-host": "app.example.com",
+ }),
+ );
+ // sanitizeAuthNext drops the crafted value, so we land on the resolved
+ // in-app target under our own host — never evil.com.
+ expect(response.headers.get("location")).toBe(
+ "https://app.example.com/copilot",
+ );
+ }
+ });
+});
+
+describe("auth callback GET — user creation failures", () => {
+ beforeEach(() => {
+ getServerSessionMock.mockResolvedValue({ user: { id: "user-1" } });
+ });
+
+ it("redirects to auth-token-invalid when the backend rejects with 401", async () => {
+ postV1GetOrCreateUserMock.mockRejectedValue(
+ new BackendApiErrorStub("Unauthorized", 401),
+ );
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(
+ `${origin}/error?message=auth-token-invalid`,
+ );
+ });
+
+ it("redirects to server-error when the backend rejects with a 5xx status", async () => {
+ postV1GetOrCreateUserMock.mockRejectedValue(
+ new BackendApiErrorStub("Internal Server Error", 500),
+ );
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(
+ `${origin}/error?message=server-error`,
+ );
+ expect(scheduleAccountCreatedGoalMock).not.toHaveBeenCalled();
+ });
+
+ it("redirects to rate-limited when the backend rejects with 429", async () => {
+ postV1GetOrCreateUserMock.mockRejectedValue(
+ new BackendApiErrorStub("Too Many Requests", 429),
+ );
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(
+ `${origin}/error?message=rate-limited`,
+ );
+ });
+
+ it("redirects to network-error when the fetch itself fails", async () => {
+ postV1GetOrCreateUserMock.mockRejectedValue(
+ new TypeError("Failed to fetch"),
+ );
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(
+ `${origin}/error?message=network-error`,
+ );
+ });
+
+ it("redirects to user-creation-failed for any other failure", async () => {
+ postV1GetOrCreateUserMock.mockRejectedValue(
+ new Error("something else broke"),
+ );
+
+ const response = await GET(makeCallbackRequest());
+
+ expect(response.headers.get("location")).toBe(
+ `${origin}/error?message=user-creation-failed`,
+ );
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.test.ts b/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.test.ts
deleted file mode 100644
index 2b8c75ef64..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.test.ts
+++ /dev/null
@@ -1,91 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { GET } from "./route";
-
-const mocks = vi.hoisted(() => ({
- getOnboardingStatus: vi.fn(),
- getServerSupabase: vi.fn(),
- postV1GetOrCreateUser: vi.fn(),
- revalidatePath: vi.fn(),
- scheduleAccountCreatedGoal: vi.fn(),
-}));
-
-vi.mock("@/app/api/__generated__/endpoints/auth/auth", () => ({
- postV1GetOrCreateUser: mocks.postV1GetOrCreateUser,
-}));
-vi.mock("@/app/api/helpers", () => ({
- getOnboardingStatus: mocks.getOnboardingStatus,
-}));
-vi.mock("@/lib/supabase/server/getServerSupabase", () => ({
- getServerSupabase: mocks.getServerSupabase,
-}));
-vi.mock("@/services/analytics/datafast-server", async (importOriginal) => {
- const actual =
- await importOriginal<
- typeof import("@/services/analytics/datafast-server")
- >();
- return {
- ...actual,
- scheduleAccountCreatedGoal: mocks.scheduleAccountCreatedGoal,
- };
-});
-vi.mock("next/cache", () => ({ revalidatePath: mocks.revalidatePath }));
-
-describe("OAuth callback account creation tracking", () => {
- beforeEach(() => {
- vi.clearAllMocks();
- vi.stubEnv("NODE_ENV", "development");
- mocks.getServerSupabase.mockResolvedValue({
- auth: {
- exchangeCodeForSession: vi.fn().mockResolvedValue({ error: null }),
- },
- });
- mocks.getOnboardingStatus.mockResolvedValue({
- shouldShowOnboarding: false,
- });
- });
-
- it("tracks a newly created Google account", async () => {
- mocks.postV1GetOrCreateUser.mockResolvedValue({
- status: 200,
- data: {},
- headers: new Headers({ "X-AutoGPT-User-Created": "true" }),
- });
-
- const response = await GET(
- new Request("http://localhost/auth/callback?code=valid"),
- );
-
- expect(response.headers.get("location")).toBe("http://localhost/copilot");
- expect(mocks.scheduleAccountCreatedGoal).toHaveBeenCalledOnce();
- expect(mocks.scheduleAccountCreatedGoal).toHaveBeenCalledWith("google");
- });
-
- it("does not track a returning Google user", async () => {
- mocks.postV1GetOrCreateUser.mockResolvedValue({
- status: 200,
- data: {},
- headers: new Headers({ "X-AutoGPT-User-Created": "false" }),
- });
-
- await GET(new Request("http://localhost/auth/callback?code=valid"));
-
- expect(mocks.scheduleAccountCreatedGoal).not.toHaveBeenCalled();
- });
-
- it("redirects a resolved backend error without tracking", async () => {
- mocks.postV1GetOrCreateUser.mockResolvedValue({
- status: 500,
- data: {},
- headers: new Headers(),
- });
-
- const response = await GET(
- new Request("http://localhost/auth/callback?code=valid"),
- );
-
- expect(response.headers.get("location")).toBe(
- "http://localhost/error?message=server-error",
- );
- expect(mocks.scheduleAccountCreatedGoal).not.toHaveBeenCalled();
- });
-});
diff --git a/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.ts b/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.ts
index 6edbc33e81..9fb8d9e08e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/auth/callback/route.ts
@@ -1,6 +1,8 @@
import { postV1GetOrCreateUser } from "@/app/api/__generated__/endpoints/auth/auth";
import { getOnboardingStatus } from "@/app/api/helpers";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
+import { sanitizeAuthNext } from "@/lib/auth-redirect";
+import { getServerSession } from "@/lib/auth/server/getServerSession";
+import { rollbackSession } from "@/lib/auth/server/rollbackSession";
import {
scheduleAccountCreatedGoal,
wasAccountCreated,
@@ -8,88 +10,89 @@ import {
import { revalidatePath } from "next/cache";
import { NextResponse } from "next/server";
-// Handle the callback to complete the user session login
+// Post-OAuth landing page, not the OAuth exchange. Better Auth's built-in
+// /api/auth/callback/{provider} does the code exchange and sets the session
+// cookie, then redirects here because this is the `callbackURL` we hand it in
+// /api/auth/login/with-provider. So by the time we run, the session already
+// exists and we only provision the backend user and decide where to send them.
export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url);
- const code = searchParams.get("code");
let next = "/copilot";
- if (code) {
- const supabase = await getServerSupabase();
+ const session = await getServerSession();
- if (!supabase) {
- return NextResponse.redirect(`${origin}/error`);
- }
+ if (session?.user) {
+ try {
+ const createUserResponse = await postV1GetOrCreateUser();
+ if (wasAccountCreated(createUserResponse)) {
+ await scheduleAccountCreatedGoal("google");
+ }
- const { error } = await supabase.auth.exchangeCodeForSession(code);
+ const { shouldShowOnboarding } = await getOnboardingStatus();
+ // Prefer a sanitized ?next (relative paths only — sanitizeAuthNext drops
+ // absolute and protocol-relative values, so a crafted ?next can't
+ // open-redirect the user off-site); otherwise route by onboarding state.
+ // Resolve the final target BEFORE revalidating so we revalidate the page
+ // the user actually lands on.
+ next =
+ sanitizeAuthNext(searchParams.get("next")) ??
+ (shouldShowOnboarding ? "/onboarding" : "/copilot");
+ revalidatePath(next, "layout");
+ } catch (createUserError) {
+ console.error("Error creating user:", createUserError);
- if (!error) {
- try {
- const createUserResponse = await postV1GetOrCreateUser();
- if (wasAccountCreated(createUserResponse)) {
- await scheduleAccountCreatedGoal("google");
- }
+ // Better Auth already set the session cookie before redirecting here, so
+ // a provisioning failure would otherwise leave the browser "logged in"
+ // with no backend user. Revoke the session to match login/signup, which
+ // both rollbackSession on the same failure.
+ await rollbackSession();
- const { shouldShowOnboarding } = await getOnboardingStatus();
- next = shouldShowOnboarding ? "/onboarding" : "/copilot";
- revalidatePath(next, "layout");
- } catch (createUserError) {
- console.error("Error creating user:", createUserError);
+ // Handle ApiError from the backend API client
+ if (
+ createUserError &&
+ typeof createUserError === "object" &&
+ "status" in createUserError
+ ) {
+ const apiError = createUserError as { status: number };
- // Handle ApiError from the backend API client
- if (
- createUserError &&
- typeof createUserError === "object" &&
- "status" in createUserError
- ) {
- const apiError = createUserError as any;
-
- if (apiError.status === 401) {
- // Authentication issues - token missing/invalid
- return NextResponse.redirect(
- `${origin}/error?message=auth-token-invalid`,
- );
- } else if (apiError.status >= 500) {
- // Server/database errors
- return NextResponse.redirect(
- `${origin}/error?message=server-error`,
- );
- } else if (apiError.status === 429) {
- // Rate limiting
- return NextResponse.redirect(
- `${origin}/error?message=rate-limited`,
- );
- }
- }
-
- // Handle network/fetch errors
- if (
- createUserError instanceof TypeError &&
- createUserError.message.includes("fetch")
- ) {
- return NextResponse.redirect(`${origin}/error?message=network-error`);
+ if (apiError.status === 401) {
+ // Authentication issues - token missing/invalid
+ return NextResponse.redirect(
+ `${origin}/error?message=auth-token-invalid`,
+ );
+ } else if (apiError.status >= 500) {
+ // Server/database errors
+ return NextResponse.redirect(`${origin}/error?message=server-error`);
+ } else if (apiError.status === 429) {
+ // Rate limiting
+ return NextResponse.redirect(`${origin}/error?message=rate-limited`);
}
+ }
- // Generic user creation failure
- return NextResponse.redirect(
- `${origin}/error?message=user-creation-failed`,
- );
+ // Handle network/fetch errors
+ if (
+ createUserError instanceof TypeError &&
+ createUserError.message.includes("fetch")
+ ) {
+ return NextResponse.redirect(`${origin}/error?message=network-error`);
}
- // Get redirect destination from 'next' query parameter
- next = searchParams.get("next") || next;
+ // Generic user creation failure
+ return NextResponse.redirect(
+ `${origin}/error?message=user-creation-failed`,
+ );
+ }
- const forwardedHost = request.headers.get("x-forwarded-host"); // original origin before load balancer
- const isLocalEnv = process.env.NODE_ENV === "development";
- if (isLocalEnv) {
- // we can be sure that there is no load balancer in between, so no need to watch for X-Forwarded-Host
- return NextResponse.redirect(`${origin}${next}`);
- } else if (forwardedHost) {
- return NextResponse.redirect(`https://${forwardedHost}${next}`);
- } else {
- return NextResponse.redirect(`${origin}${next}`);
- }
+ const forwardedHost = request.headers.get("x-forwarded-host"); // original origin before load balancer
+ const isLocalEnv = process.env.NODE_ENV === "development";
+ if (isLocalEnv) {
+ // we can be sure that there is no load balancer in between, so no need to watch for X-Forwarded-Host
+ return NextResponse.redirect(`${origin}${next}`);
+ } else if (forwardedHost) {
+ return NextResponse.redirect(`https://${forwardedHost}${next}`);
+ } else {
+ return NextResponse.redirect(`${origin}${next}`);
}
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/auth/confirm/route.ts b/autogpt_platform/frontend/src/app/(platform)/auth/confirm/route.ts
deleted file mode 100644
index a9b7c6f751..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/auth/confirm/route.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { type EmailOtpType } from "@supabase/supabase-js";
-import { type NextRequest } from "next/server";
-
-import { redirect } from "next/navigation";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
-
-// Email confirmation route
-export async function GET(request: NextRequest) {
- const { searchParams } = new URL(request.url);
- const token_hash = searchParams.get("token_hash");
- const type = searchParams.get("type") as EmailOtpType | null;
- const next = searchParams.get("next") ?? "/";
-
- if (token_hash && type) {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- redirect("/error");
- }
-
- const { error } = await supabase.auth.verifyOtp({
- type,
- token_hash,
- });
- if (!error) {
- // redirect user to specified redirect URL or root of app
- redirect(next);
- }
- }
-
- // redirect the user to an error page with some instructions
- redirect("/error");
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/__tests__/useIsReadOnlyGraph.test.tsx b/autogpt_platform/frontend/src/app/(platform)/build/__tests__/useIsReadOnlyGraph.test.tsx
index be4c902e86..1abbbb7bb7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/__tests__/useIsReadOnlyGraph.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/build/__tests__/useIsReadOnlyGraph.test.tsx
@@ -3,8 +3,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
let mockUser: { id: string } | null = null;
let mockIsUserLoading = false;
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ user: mockUser, isUserLoading: mockIsUserLoading }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ user: mockUser, isUserLoading: mockIsUserLoading }),
}));
vi.mock("nuqs", () => ({
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx
index ae8d1f9af6..71bdce9631 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/BuilderActions/components/PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx
@@ -15,10 +15,10 @@ import {
waitFor,
} from "@/tests/integrations/test-utils";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@sentry/nextjs", async () => {
@@ -113,11 +113,10 @@ function installScopedHandlers() {
describe("PublishToMarketplace (builder)", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/hooks/useIsReadOnlyGraph.ts b/autogpt_platform/frontend/src/app/(platform)/build/hooks/useIsReadOnlyGraph.ts
index 7aa2d21d88..8076f195d3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/hooks/useIsReadOnlyGraph.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/build/hooks/useIsReadOnlyGraph.ts
@@ -1,13 +1,13 @@
import { useGetV1GetSpecificGraph } from "@/app/api/__generated__/endpoints/graphs/graphs";
import { GraphModel } from "@/app/api/__generated__/models/graphModel";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { parseAsInteger, parseAsString, useQueryStates } from "nuqs";
// Read-only detection is a UX affordance only — the backend is the security
// boundary and already rejects mutations (save, etc.) from non-owners. This
// hook just hides controls that would otherwise fail silently.
export function useIsReadOnlyGraph() {
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
const [{ flowID, flowVersion }] = useQueryStates({
flowID: parseAsString,
diff --git a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchModal.tsx b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchModal.tsx
index ca9fd2ea04..afb9b0141c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchModal.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/components/GlobalSearchModal/GlobalSearchModal.tsx
@@ -1,7 +1,7 @@
import type { SearchResultItem } from "@/app/api/__generated__/models/searchResultItem";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { SearchCommandModal } from "@/components/organisms/SearchCommandModal/SearchCommandModal";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { usePathname, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { ACTIONS_BUCKET_KEY, COPY_USER_ID_ACTION } from "./actions";
@@ -18,7 +18,7 @@ export function GlobalSearchModal({ isOpen, onClose, onSelectItem }: Props) {
const router = useRouter();
const pathname = usePathname();
const { toast } = useToast();
- const { user } = useSupabase();
+ const { user } = useAuth();
const { query, setQuery, buckets, itemsById, isFetching, isError } =
useGlobalSearch(isOpen);
// Id of the row whose select is in-flight. The modal stays open with a
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx
index 07fe5c53af..4ae00de3a8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx
@@ -3,8 +3,8 @@
import { LowCreditBanner } from "@/components/layout/TopUpPrompt/LowCreditBanner/LowCreditBanner";
import { DotDistortionShader } from "@/components/ui/dot-distortion-shader";
import { SidebarProvider } from "@/components/ui/sidebar";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { NAVBAR_HEIGHT_PX } from "@/lib/constants";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { usePlatformChrome } from "../PlatformChrome/usePlatformChrome";
import dynamic from "next/dynamic";
@@ -47,7 +47,7 @@ export function CopilotPage() {
// hidden in lockstep with the layout swap — avoids a one-frame flash where
// the classic shell renders without its sidebar before the new layout mounts.
const { showNewLayout } = usePlatformChrome();
- const { isUserLoading, isLoggedIn } = useSupabase();
+ const { isUserLoading, isLoggedIn } = useAuth();
// Read sessionId here purely to key the chat-host subtree. The view still
// remounts on session switch, but the underlying AI SDK Chat runtime now
// lives in a per-session registry so live streams can continue in
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx
index 116421dffc..e3efbfb852 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/CopilotPage.test.tsx
@@ -82,9 +82,9 @@ vi.mock("@/services/feature-flags/use-get-flag", () => ({
// Auth check moved into CopilotPage directly — default to a logged-in
// user so the page renders past its loading gate.
-const mockSupabase = vi.fn(() => ({ isUserLoading: false, isLoggedIn: true }));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => mockSupabase(),
+const mockUseAuth = vi.fn(() => ({ isUserLoading: false, isLoggedIn: true }));
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => mockUseAuth(),
}));
// sessionId is read via nuqs to key the chat-host subtree; stub it so
@@ -135,8 +135,8 @@ afterEach(() => {
cleanup();
mockUseCopilotPage.mockReset();
mockUseCopilotPage.mockImplementation(() => basePageState);
- mockSupabase.mockReset();
- mockSupabase.mockImplementation(() => ({
+ mockUseAuth.mockReset();
+ mockUseAuth.mockImplementation(() => ({
isUserLoading: false,
isLoggedIn: true,
}));
@@ -190,8 +190,8 @@ describe("CopilotPage test-mode banner", () => {
});
it("shows loading spinner when user is loading", () => {
- // Auth check moved to CopilotPage — mock useSupabase directly.
- mockSupabase.mockReturnValue({ isUserLoading: true, isLoggedIn: false });
+ // Auth check moved to CopilotPage — mock useAuth directly.
+ mockUseAuth.mockReturnValue({ isUserLoading: true, isLoggedIn: false });
render(<CopilotPage />);
expect(screen.getByTestId("scale-loader")).toBeDefined();
expect(screen.queryByTestId("chat-container")).toBeNull();
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx
index 3e7278c5f6..fbbe5df7c4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx
@@ -28,7 +28,7 @@ vi.mock("@/services/environment", async (importActual) => {
};
});
-// Replace the Supabase token fetch with a static header so we don't need
+// Replace the auth token fetch with a static header so we don't need
// real auth in tests.
vi.mock("../helpers", async (importActual) => {
const actual = await importActual<typeof import("../helpers")>();
@@ -38,9 +38,9 @@ vi.mock("../helpers", async (importActual) => {
};
});
-// useChatSession depends on useSupabase via useCopilotPage's auth gate.
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+// useChatSession depends on useAuth via useCopilotPage's auth gate.
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
// Keep mode/model toggles and artifacts off so the chat input renders a
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx
index 20647b17ec..cfdc68df27 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx
@@ -33,8 +33,8 @@ vi.mock("../helpers", async (importActual) => {
};
});
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", () => ({
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx
index faecaf7c39..aa77678025 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx
@@ -34,8 +34,8 @@ vi.mock("../helpers", async (importActual) => {
};
});
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", () => ({
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-mode-switch.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-mode-switch.test.tsx
index 4c8cf0a60f..adafe03fa7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-mode-switch.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-mode-switch.test.tsx
@@ -35,8 +35,8 @@ vi.mock("../helpers", async (importActual) => {
};
});
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", () => ({
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/helpers.test.ts
index f27516d3f5..71c949c453 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/helpers.test.ts
@@ -16,7 +16,7 @@ import {
shouldSuppressDuplicateSend,
} from "../helpers";
-vi.mock("@/lib/supabase/actions", () => ({
+vi.mock("@/lib/auth/actions", () => ({
getWebSocketToken: vi.fn(),
}));
@@ -24,7 +24,7 @@ vi.mock("@/lib/impersonation", () => ({
getSystemHeaders: vi.fn(),
}));
-import { getWebSocketToken } from "@/lib/supabase/actions";
+import { getWebSocketToken } from "@/lib/auth/actions";
import { getSystemHeaders } from "@/lib/impersonation";
const mockGetWebSocketToken = vi.mocked(getWebSocketToken);
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx
index fabd8a6aef..788b81c4f9 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/low-credit-banner.test.tsx
@@ -79,8 +79,8 @@ vi.mock("../useCopilotPage", () => ({
}),
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
// sessionId is read via nuqs to key the chat-host subtree; stub it.
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/useCopilotStream.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/useCopilotStream.test.tsx
index 72559b975f..10481e5947 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/useCopilotStream.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/useCopilotStream.test.tsx
@@ -36,8 +36,8 @@ vi.mock("../helpers", async (importActual) => {
};
});
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", () => ({
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
index 35a4cf25c8..641e33bc0a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/EmptySession.tsx
@@ -4,9 +4,9 @@ import { ChatInput } from "@/app/(platform)/copilot/components/ChatInput/ChatInp
import { useGetV2GetSuggestedPrompts } from "@/app/api/__generated__/endpoints/chat/chat";
import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";
import { Text } from "@/components/atoms/Text/Text";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { DotDistortionShader } from "@/components/ui/dot-distortion-shader";
import { TextGenerateEffect } from "@/components/ui/text-generate-effect";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { motion } from "framer-motion";
import { useEffect, useState } from "react";
import {
@@ -47,7 +47,7 @@ export function EmptySession({
onDroppedFilesConsumed,
isAdoptingExpertSession,
}: Props) {
- const { user } = useSupabase();
+ const { user } = useAuth();
const greetingName = getGreetingName(user);
const isAgentBriefingEnabled = useGetFlag(Flag.AGENT_BRIEFING);
const isExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/__tests__/helpers.test.ts
index f5037282d3..a615d2496b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/__tests__/helpers.test.ts
@@ -1,4 +1,4 @@
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { describe, expect, it } from "vitest";
import { getGreetingName } from "../helpers";
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/EditNameDialog.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/EditNameDialog.tsx
index 8ad6328f51..9556d1e859 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/EditNameDialog.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/EditNameDialog.tsx
@@ -4,7 +4,7 @@ import { Button } from "@/components/atoms/Button/Button";
import { Input } from "@/components/atoms/Input/Input";
import { Dialog } from "@/components/molecules/Dialog/Dialog";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { PencilSimpleIcon } from "@phosphor-icons/react";
import { useState } from "react";
@@ -16,7 +16,7 @@ export function EditNameDialog({ currentName }: Props) {
const [isOpen, setIsOpen] = useState(false);
const [name, setName] = useState(currentName);
const [isSaving, setIsSaving] = useState(false);
- const { refreshSession } = useSupabase();
+ const { refreshSession } = useAuth();
const { toast } = useToast();
function handleOpenChange(open: boolean) {
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/__tests__/EditNameDialog.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/__tests__/EditNameDialog.test.tsx
index e2dd2bb069..424a84050e 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/__tests__/EditNameDialog.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/components/EditNameDialog/__tests__/EditNameDialog.test.tsx
@@ -16,8 +16,8 @@ vi.mock("@/components/molecules/Toast/use-toast", () => ({
useToast: () => ({ toast: mockToast }),
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
refreshSession: mockRefreshSession,
}),
}));
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/helpers.ts
index 7a8ac246b3..03988b4210 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/EmptySession/helpers.ts
@@ -1,4 +1,4 @@
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
export function getInputPlaceholder(width?: number) {
if (!width) return "What's your role and what eats up most of your day?";
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
index 0eaa201cd5..209e10fa1a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
@@ -3,7 +3,7 @@ import { scrollbarStyles } from "@/components/styles/scrollbars";
import { Button as ShadcnButton } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Separator } from "@/components/ui/separator";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { cn } from "@/lib/utils";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import {
@@ -28,7 +28,7 @@ import { DeleteChatDialog } from "../DeleteChatDialog/DeleteChatDialog";
import { UsagePopover } from "../UsageLimits/UsagePopover/UsagePopover";
export function MobileDrawer() {
- const { isUserLoading, isLoggedIn } = useSupabase();
+ const { isUserLoading, isLoggedIn } = useAuth();
const searchInputRef = useRef<HTMLInputElement>(null);
const [currentSessionId, setSessionId] = useQueryState(
"sessionId",
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx
index 14c883ecd7..5e91ac74d9 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawer.test.tsx
@@ -13,8 +13,8 @@ import {
import { useCopilotUIStore } from "../../../store";
import { MobileDrawer } from "../MobileDrawer";
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx
index 1c7a4bb99e..26ed72dc59 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/__tests__/MobileDrawerControls.test.tsx
@@ -14,8 +14,8 @@ import {
import { useCopilotUIStore } from "../../../store";
import { MobileDrawer } from "../MobileDrawer";
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isUserLoading: false, isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isUserLoading: false, isLoggedIn: true }),
}));
vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers.ts
index 2b1a4c1f01..0ff6837532 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/helpers.ts
@@ -1,5 +1,5 @@
import { getSystemHeaders } from "@/lib/impersonation";
-import { getWebSocketToken } from "@/lib/supabase/actions";
+import { getWebSocketToken } from "@/lib/auth/actions";
import type { UIMessage } from "ai";
import { deleteV2DisconnectSessionStream } from "@/app/api/__generated__/endpoints/chat/chat";
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
index ba12ce47c2..252417a504 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/useCopilotPage.ts
@@ -1,5 +1,5 @@
import { toast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import type { UIMessage } from "ai";
import { parseAsString, useQueryState } from "nuqs";
@@ -39,7 +39,7 @@ function hasAssistantTail(messages: UIMessage[]) {
}
export function useCopilotPage() {
- const { isUserLoading, isLoggedIn } = useSupabase();
+ const { isUserLoading, isLoggedIn } = useAuth();
const isModeToggleEnabled = useGetFlag(Flag.CHAT_MODE_OPTION);
const isExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);
const [expertIdParam] = useQueryState("expertId", parseAsString);
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/trigger-agents.test.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/trigger-agents.test.tsx
index 2b84e808fb..6fe85428fb 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/trigger-agents.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/trigger-agents.test.tsx
@@ -48,12 +48,11 @@ vi.mock("next/navigation", async (importOriginal) => {
};
});
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
user: { id: "user-1", email: "[email protected]" },
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
}),
}));
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/hooks/useMarketplaceUpdate.ts b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/hooks/useMarketplaceUpdate.ts
index 2e937f6cd5..aaab703f89 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/hooks/useMarketplaceUpdate.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/hooks/useMarketplaceUpdate.ts
@@ -9,7 +9,7 @@ import {
import { useToast } from "@/components/molecules/Toast/use-toast";
import type { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
import { useQueryClient } from "@tanstack/react-query";
-import { useSupabaseStore } from "@/lib/supabase/hooks/useSupabaseStore";
+import { useAuthStore } from "@/lib/auth/hooks/useAuthStore";
import { okData } from "@/app/api/helpers";
import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission";
import * as React from "react";
@@ -23,7 +23,7 @@ export function useMarketplaceUpdate({ agent }: UseMarketplaceUpdateProps) {
const [modalOpen, setModalOpen] = useState(false);
const { toast } = useToast();
const queryClient = useQueryClient();
- const user = useSupabaseStore((state) => state.user);
+ const user = useAuthStore((state) => state.user);
// Get marketplace data if agent has marketplace listing
const { data: storeAgentData } = useGetV2GetSpecificAgent(
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/useLibraryAgentCard.ts b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/useLibraryAgentCard.ts
index 4362da1ea8..5d3b2bc522 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/useLibraryAgentCard.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/useLibraryAgentCard.ts
@@ -9,7 +9,7 @@ import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
import { okData } from "@/app/api/helpers";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { updateFavoriteInQueries } from "./helpers";
interface Props {
@@ -25,7 +25,7 @@ export function useLibraryAgentCard({ agent, onFavoriteAdd }: Props) {
const { toast } = useToast();
const queryClient = getQueryClient();
const { mutateAsync: updateLibraryAgent } = usePatchV2UpdateLibraryAgent();
- const { user, isLoggedIn } = useSupabase();
+ const { user, isLoggedIn } = useAuth();
const logoutInProgress = isLogoutInProgress();
const { data: profile } = useGetV2GetUserProfile({
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
index ce1d01e842..f57c4048ae 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/experts-section.test.tsx
@@ -11,10 +11,10 @@ import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { MainMarkeplacePage } from "../components/MainMarketplacePage/MainMarketplacePage";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
@@ -62,7 +62,7 @@ function renderMarketplace() {
describe("Marketplace ExpertsSection", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: { id: "user-1" },
isLoggedIn: true,
});
@@ -88,7 +88,7 @@ describe("Marketplace ExpertsSection", () => {
});
test("stays hidden and fetches nothing for signed-out visitors", async () => {
- mockUseSupabase.mockReturnValue({ user: null, isLoggedIn: false });
+ mockUseAuth.mockReturnValue({ user: null, isLoggedIn: false });
let templatesRequested = false;
server.use(
getListExpertTemplatesMockHandler(() => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx
index 9c631f5943..0abccc9101 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/__tests__/install-on-expert.test.tsx
@@ -16,10 +16,10 @@ import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { MainAgentPage } from "../components/MainAgentPage/MainAgentPage";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => {
@@ -86,7 +86,7 @@ function renderAgentPage() {
describe("Install on Expert from marketplace detail", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: { id: "user-1" },
isLoggedIn: true,
});
@@ -194,7 +194,7 @@ describe("Install on Expert from marketplace detail", () => {
test("hides the action for signed-out visitors without fetching experts", async () => {
let expertsRequested = false;
- mockUseSupabase.mockReturnValue({ user: null, isLoggedIn: false });
+ mockUseAuth.mockReturnValue({ user: null, isLoggedIn: false });
useStoreHandlers();
server.use(
getListExpertsMockHandler(() => {
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/agent/[creator]/[slug]/page.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/agent/[creator]/[slug]/page.tsx
index 8106694fe7..b1c06a0453 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/agent/[creator]/[slug]/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/agent/[creator]/[slug]/page.tsx
@@ -6,7 +6,7 @@ import {
} from "@/app/api/__generated__/endpoints/store/store";
import { StoreAgentDetails } from "@/app/api/__generated__/models/storeAgentDetails";
import { getQueryClient } from "@/lib/react-query/queryClient";
-import { getServerUser } from "@/lib/supabase/server/getServerUser";
+import { getServerUser } from "@/lib/auth/server/getServerUser";
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
import { Metadata } from "next";
import { MainAgentPage } from "../../../components/MainAgentPage/MainAgentPage";
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AddToLibraryButton/AddToLibraryButton.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AddToLibraryButton/AddToLibraryButton.tsx
index a50b17cf58..4ea585c91a 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AddToLibraryButton/AddToLibraryButton.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AddToLibraryButton/AddToLibraryButton.tsx
@@ -11,7 +11,7 @@ import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
import { LibraryAgentResponse } from "@/app/api/__generated__/models/libraryAgentResponse";
import { Button } from "@/components/atoms/Button/Button";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { analytics } from "@/services/analytics";
import { PlusIcon } from "@phosphor-icons/react";
import * as Sentry from "@sentry/nextjs";
@@ -77,7 +77,7 @@ export function AddToLibraryButton({
className,
isInLibrary,
}: Props) {
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
const { toast } = useToast();
const queryClient = useQueryClient();
const [justAdded, setJustAdded] = useState(false);
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentInfo/AgentInfo.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentInfo/AgentInfo.tsx
index 3482e3f32d..c1e74736af 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentInfo/AgentInfo.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/AgentInfo/AgentInfo.tsx
@@ -15,7 +15,7 @@ import { Text } from "@/components/atoms/Text/Text";
import { Dialog } from "@/components/molecules/Dialog/Dialog";
import { formatTimeAgo } from "@/lib/utils/time";
import { PlusIcon } from "@phosphor-icons/react";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import Link from "next/link";
import { InstallOnExpertButton } from "../InstallOnExpertButton/InstallOnExpertButton";
import { useAgentInfo } from "./useAgentInfo";
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
index 00e33a28bd..fac73955c5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/ExpertsSection/useExpertsSection.ts
@@ -3,14 +3,14 @@ import {
useListExpertTemplates,
} from "@/app/api/__generated__/endpoints/experts/experts";
import { Expert } from "@/app/api/__generated__/models/expert";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useState } from "react";
export function useExpertsSection() {
const [selectedTemplateId, setSelectedTemplateId] = useState<string | null>(
null,
);
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
const templatesQuery = useListExpertTemplates({
query: { select: (x) => x.data as Expert[], enabled: isLoggedIn },
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/InstallOnExpertButton/useInstallOnExpertButton.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/InstallOnExpertButton/useInstallOnExpertButton.ts
index d322bc3bfb..6beed6f359 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/InstallOnExpertButton/useInstallOnExpertButton.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/InstallOnExpertButton/useInstallOnExpertButton.ts
@@ -1,12 +1,12 @@
import { useListExperts } from "@/app/api/__generated__/endpoints/experts/experts";
import { Expert } from "@/app/api/__generated__/models/expert";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { useState } from "react";
export function useInstallOnExpertButton() {
const hireExpertsEnabled = useGetFlag(Flag.HIRE_EXPERTS);
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
const [pickerOpen, setPickerOpen] = useState(false);
const canFetchExperts = Boolean(hireExpertsEnabled) && isLoggedIn;
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/__tests__/main.test.tsx
index d4e8774817..a2a775c769 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/__tests__/main.test.tsx
@@ -9,15 +9,15 @@ import { render, screen } from "@/tests/integrations/test-utils";
import { MainAgentPage } from "../MainAgentPage";
import { beforeEach, describe, expect, test, vi } from "vitest";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
describe("MainAgentPage", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: null,
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/useMainAgentPage.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/useMainAgentPage.ts
index 674955545e..354caa0c9b 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/useMainAgentPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainAgentPage/useMainAgentPage.ts
@@ -7,7 +7,7 @@ import { useGetV2GetAgentByStoreId } from "@/app/api/__generated__/endpoints/lib
import { StoreAgentsResponse } from "@/app/api/__generated__/models/storeAgentsResponse";
import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";
import { okData } from "@/app/api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
export const useMainAgentPage = ({
params,
@@ -15,7 +15,7 @@ export const useMainAgentPage = ({
params: MarketplaceAgentPageParams;
}) => {
const creator_lower = params.creator.toLowerCase();
- const { user } = useSupabase();
+ const { user } = useAuth();
const {
data: agent,
isLoading: isAgentLoading,
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/__tests__/page.test.tsx
index c6cd516c26..19d20689c5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/__tests__/page.test.tsx
@@ -13,14 +13,14 @@ import { server } from "@/mocks/mock-server";
import UserProfilePage from "../page";
import { beforeEach, describe, expect, test, vi } from "vitest";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
vi.mock("@/providers/onboarding/onboarding-provider", () => ({
default: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
const testUser = {
@@ -34,11 +34,10 @@ const testUser = {
describe("UserProfilePage", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts
index 6125063678..83dfbae12d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/dashboard/components/MainDashboardPage/useMainDashboardPage.ts
@@ -7,7 +7,7 @@ import { StoreSubmission } from "@/app/api/__generated__/models/storeSubmission"
import { StoreSubmissionEditRequest } from "@/app/api/__generated__/models/storeSubmissionEditRequest";
import { StoreSubmissionsResponse } from "@/app/api/__generated__/models/storeSubmissionsResponse";
import { getQueryClient } from "@/lib/react-query/queryClient";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useState } from "react";
import * as Sentry from "@sentry/nextjs";
@@ -32,7 +32,7 @@ type EditState = {
export const useMainDashboardPage = () => {
const queryClient = getQueryClient();
- const { user } = useSupabase();
+ const { user } = useAuth();
const [publishState, setPublishState] = useState<PublishState>({
isOpen: false,
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/integrations/page.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/integrations/page.tsx
index bde831c535..938dc75456 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/integrations/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/integrations/page.tsx
@@ -15,7 +15,7 @@ import { Dialog } from "@/components/molecules/Dialog/Dialog";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { providerIcons } from "@/components/renderers/InputRenderer/custom/CredentialField/helpers";
import { CredentialsProviderName } from "@/lib/autogpt-server-api";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { CredentialsProvidersContext } from "@/providers/agent-credentials/credentials-provider";
import { KeyIcon } from "@phosphor-icons/react/dist/ssr";
import { Trash2Icon } from "lucide-react";
@@ -23,7 +23,7 @@ import { useRouter } from "next/navigation";
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
export default function UserIntegrationsPage() {
- const { supabase, user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
const router = useRouter();
const providers = useContext(CredentialsProvidersContext);
const { toast } = useToast();
@@ -124,8 +124,8 @@ export default function UserIntegrationsPage() {
useEffect(() => {
if (isUserLoading) return;
- if (!user || !supabase) router.push("/login");
- }, [isUserLoading, user, supabase, router]);
+ if (!user) router.push("/login");
+ }, [isUserLoading, user, router]);
if (isUserLoading) {
return <LoadingBox className="h-[80vh]" />;
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/page.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/page.tsx
index 4320e0719c..21834e0dc6 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/page.tsx
@@ -5,11 +5,11 @@ import { ProfileInfoForm } from "@/components/__legacy__/ProfileInfoForm";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
import type { ProfileDetails } from "@/app/api/__generated__/models/profileDetails";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { ProfileLoading } from "./ProfileLoading";
export default function UserProfilePage() {
- const { user } = useSupabase();
+ const { user } = useAuth();
const logoutInProgress = isLogoutInProgress();
const {
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/__tests__/page.test.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/__tests__/page.test.tsx
index 75c706dbcb..1eb1576630 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/__tests__/page.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/__tests__/page.test.tsx
@@ -15,14 +15,14 @@ import { server } from "@/mocks/mock-server";
import SettingsPage from "../page";
import { beforeEach, describe, expect, test, vi } from "vitest";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
vi.mock("@/providers/onboarding/onboarding-provider", () => ({
default: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
const testUser = {
@@ -36,11 +36,10 @@ const testUser = {
describe("SettingsPage", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/SettingsForm.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/SettingsForm.tsx
index 5a42db20c0..e6c973e0dc 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/SettingsForm.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/SettingsForm.tsx
@@ -2,7 +2,7 @@
import { NotificationPreference } from "@/app/api/__generated__/models/notificationPreference";
import { Separator } from "@/components/__legacy__/ui/separator";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { EmailForm } from "./components/EmailForm/EmailForm";
import { NotificationForm } from "./components/NotificationForm/NotificationForm";
import { TimezoneForm } from "./components/TimezoneForm/TimezoneForm";
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/EmailForm.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/EmailForm.tsx
index 1901bf709a..a74df39cc4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/EmailForm.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/EmailForm.tsx
@@ -9,7 +9,7 @@ import {
import { Button } from "@/components/atoms/Button/Button";
import { Input } from "@/components/atoms/Input/Input";
import { Text } from "@/components/atoms/Text/Text";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { useEmailForm } from "./useEmailForm";
type EmailFormProps = {
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/__tests__/EmailForm.test.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/__tests__/EmailForm.test.tsx
index fb7e4d397a..db6cd11bc9 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/__tests__/EmailForm.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/__tests__/EmailForm.test.tsx
@@ -5,49 +5,45 @@ import {
waitFor,
} from "@/tests/integrations/test-utils";
import type { ReactNode } from "react";
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { EmailForm } from "../EmailForm";
const mockToast = vi.hoisted(() => vi.fn());
-const mockMutateAsync = vi.hoisted(() => vi.fn());
vi.mock("@/components/molecules/Toast/use-toast", () => ({
useToast: () => ({ toast: mockToast }),
}));
-vi.mock("@/app/api/__generated__/endpoints/auth/auth", () => ({
- usePostV1UpdateUserEmail: () => ({
- mutateAsync: mockMutateAsync,
- isPending: false,
- }),
-}));
-
vi.mock("@/providers/onboarding/onboarding-provider", () => ({
default: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
+// Verified by default: the Supabase copy migration carries email_confirmed_at
+// across, so users who had confirmed take this path. Unverified ones (never
+// confirmed, or signed up since — signup verification is off) take the other.
const testUser = {
id: "user-1",
+ email_verified: true,
app_metadata: {},
user_metadata: {},
aud: "authenticated",
created_at: "2026-01-01T00:00:00.000Z",
} as User;
+const unverifiedUser = { ...testUser, email_verified: false } as User;
+
describe("EmailForm", () => {
beforeEach(() => {
mockToast.mockReset();
- mockMutateAsync.mockReset();
- mockMutateAsync.mockResolvedValue({});
});
afterEach(() => {
vi.unstubAllGlobals();
});
- test("submits a changed email to both update endpoints", async () => {
+ test("routes the change only through Better Auth (verification-gated), never an eager platform write", async () => {
const fetchMock = vi.fn().mockResolvedValue({
ok: true,
json: async () => ({}),
@@ -71,16 +67,72 @@ describe("EmailForm", () => {
body: JSON.stringify({ email: "[email protected]" }),
});
});
+
+ // The Better Auth PUT is the ONLY write — the old parallel platform-email
+ // mutation is gone, so the change can't land unverified.
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+
+ // Toast reflects the pending confirmation, not a completed change.
await waitFor(() => {
- expect(mockMutateAsync).toHaveBeenCalledWith({
- });
+ expect(mockToast).toHaveBeenCalledWith(
+ expect.objectContaining({
+ title: "Confirm your new email",
+ }),
+ );
+ });
+ });
+
+ test("tells an unverified user the change already applied", async () => {
+ // Better Auth only sends the current-address confirmation when the user is
+ // verified; for an unverified user it applies the change immediately, so
+ // promising them a confirmation email would be a lie.
+ const fetchMock = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => ({}),
+ });
+
+ vi.stubGlobal("fetch", fetchMock);
+
+ render(<EmailForm user={unverifiedUser} />);
+
+ fireEvent.change(screen.getByLabelText("Email"), {
+ target: { value: "[email protected]" },
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Update email" }));
+
+ await waitFor(() => {
+ expect(mockToast).toHaveBeenCalledWith(
+ expect.objectContaining({
+ title: "Email updated",
+ }),
+ );
+ });
+ });
+
+ test("surfaces a change failure as an error toast", async () => {
+ const fetchMock = vi.fn().mockResolvedValue({
+ ok: false,
+ json: async () => ({ error: "Email already in use" }),
+ });
+
+ vi.stubGlobal("fetch", fetchMock);
+
+ render(<EmailForm user={testUser} />);
+
+ fireEvent.change(screen.getByLabelText("Email"), {
+ target: { value: "[email protected]" },
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Update email" }));
+
+ await waitFor(() => {
+ expect(mockToast).toHaveBeenCalledWith(
+ expect.objectContaining({
+ title: "Error updating email",
+ description: "Email already in use",
+ variant: "destructive",
+ }),
+ );
});
- expect(mockToast).toHaveBeenCalledWith(
- expect.objectContaining({
- title: "Successfully updated email",
- }),
- );
});
test("keeps submit disabled when the email has not changed", () => {
@@ -94,4 +146,37 @@ describe("EmailForm", () => {
).disabled,
).toBe(true);
});
+
+ test("does not re-send after a successful request until the address changes again", async () => {
+ // On the verified path Better Auth doesn't write the row until the link is
+ // clicked, so user.email stays old. Without resetting the form the submit
+ // button stays enabled and every further click sends another email.
+ const fetchMock = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => ({}),
+ });
+
+ vi.stubGlobal("fetch", fetchMock);
+
+ render(<EmailForm user={testUser} />);
+
+ fireEvent.change(screen.getByLabelText("Email"), {
+ target: { value: "[email protected]" },
+ });
+ fireEvent.click(screen.getByRole("button", { name: "Update email" }));
+
+ await waitFor(() => {
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
+
+ // The field is back to the current address, so the guard now short-circuits.
+ await waitFor(() => {
+ expect((screen.getByLabelText("Email") as HTMLInputElement).value).toBe(
+ testUser.email,
+ );
+ });
+
+ fireEvent.click(screen.getByRole("button", { name: "Update email" }));
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/actions.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/actions.ts
deleted file mode 100644
index 95ffb9139f..0000000000
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/actions.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
-
-export async function updateSupabaseUserEmail(email: string) {
- const supabase = await getServerSupabase();
- const { data, error } = await supabase.auth.updateUser({
- email,
- });
-
- return { data, error };
-}
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/useEmailForm.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/useEmailForm.ts
index b6a6d1074b..de2ee2ac5d 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/useEmailForm.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/EmailForm/useEmailForm.ts
@@ -1,11 +1,11 @@
"use client";
+import { useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { User } from "@supabase/supabase-js";
-import { usePostV1UpdateUserEmail } from "@/app/api/__generated__/endpoints/auth/auth";
+import type { User } from "@/lib/auth/types";
const emailFormSchema = z.object({
email: z
@@ -20,7 +20,14 @@ function createEmailDefaultValues(user: { email?: string }) {
};
}
-async function updateUserEmailAPI(email: string) {
+// Better Auth owns the email change. For a verified user it emails a
+// confirmation link to their CURRENT address and only applies the new email
+// once that link is clicked (anti-takeover); for an unverified user the change
+// applies immediately. Platform User.email (notifications / Stripe) then
+// converges via the databaseHooks.user.update mirror in lib/auth/auth.ts — we
+// deliberately do NOT write the platform email here, so it can never diverge to
+// an unverified value.
+async function requestEmailChange(email: string) {
const response = await fetch("/api/auth/user", {
method: "PUT",
headers: {
@@ -41,6 +48,7 @@ export function useEmailForm({ user }: { user: User }) {
const { toast } = useToast();
const defaultValues = createEmailDefaultValues(user);
const currentEmail = user.email;
+ const [isSubmitting, setIsSubmitting] = useState(false);
const form = useForm<z.infer<typeof emailFormSchema>>({
resolver: zodResolver(emailFormSchema),
@@ -48,31 +56,29 @@ export function useEmailForm({ user }: { user: User }) {
mode: "onSubmit",
});
- const updateEmailMutation = usePostV1UpdateUserEmail({
- mutation: {
- onError: (error) => {
- toast({
- title: "Error updating email",
- description:
- error instanceof Error ? error.message : "Failed to update email",
- variant: "destructive",
- });
- },
- },
- });
-
async function onSubmit(values: z.infer<typeof emailFormSchema>) {
- try {
- if (values.email !== user.email) {
- await Promise.all([
- updateUserEmailAPI(values.email),
- updateEmailMutation.mutateAsync({ data: values.email }),
- ]);
+ if (values.email === user.email) return;
- toast({
- title: "Successfully updated email",
- });
- }
+ setIsSubmitting(true);
+ try {
+ await requestEmailChange(values.email);
+ // Reset to the still-current address. On the verified path Better Auth
+ // deliberately doesn't write the row until the link is clicked, so
+ // `user.email` stays old — leaving the new value in the field would keep
+ // the submit button enabled and fire another email on every click.
+ form.reset({ email: currentEmail });
+ toast(
+ user.email_verified
+ ? {
+ title: "Confirm your new email",
+ description:
+ "We sent a confirmation link to your current email address. Your email changes once you click it.",
+ }
+ : {
+ title: "Email updated",
+ description: `Your email is now ${values.email}.`,
+ },
+ );
} catch (error) {
toast({
title: "Error updating email",
@@ -80,13 +86,15 @@ export function useEmailForm({ user }: { user: User }) {
error instanceof Error ? error.message : "Something went wrong",
variant: "destructive",
});
+ } finally {
+ setIsSubmitting(false);
}
}
return {
form,
onSubmit,
- isLoading: updateEmailMutation.isPending,
+ isLoading: isSubmitting,
currentEmail,
};
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/NotificationForm.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/NotificationForm.tsx
index 8b85488cf5..3f0ff7ca24 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/NotificationForm.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/NotificationForm.tsx
@@ -9,7 +9,7 @@ import {
import { Text } from "@/components/atoms/Text/Text";
import { Button } from "@/components/atoms/Button/Button";
import { NotificationPreference } from "@/app/api/__generated__/models/notificationPreference";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { useNotificationForm } from "./useNotificationForm";
import { Switch } from "@/components/atoms/Switch/Switch";
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/useNotificationForm.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/useNotificationForm.ts
index 5e998344ec..cb16b346d4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/useNotificationForm.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/NotificationForm/useNotificationForm.ts
@@ -5,7 +5,7 @@ import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { NotificationPreference } from "@/app/api/__generated__/models/notificationPreference";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { usePostV1UpdateNotificationPreferences } from "@/app/api/__generated__/endpoints/auth/auth";
import { NotificationPreferenceDTO } from "@/lib/autogpt-server-api/types";
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/TimezoneForm.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/TimezoneForm.tsx
index 66a5cf6e75..ed6a883f5f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/TimezoneForm.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/TimezoneForm.tsx
@@ -22,7 +22,7 @@ import {
SelectValue,
} from "@/components/__legacy__/ui/select";
import { Button } from "@/components/atoms/Button/Button";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import * as React from "react";
import { TIMEZONES } from "./helpers";
import { useTimezoneForm } from "./useTimezoneForm";
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/useTimezoneForm.ts b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/useTimezoneForm.ts
index 0089a60260..1c37734430 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/useTimezoneForm.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/components/SettingsForm/components/TimezoneForm/useTimezoneForm.ts
@@ -5,7 +5,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import {
usePostV1UpdateUserTimezone,
getGetV1GetUserTimezoneQueryKey,
diff --git a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/page.tsx b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/page.tsx
index 8b4d48de83..d1d847a2b8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/profile/(user)/settings/page.tsx
@@ -9,12 +9,12 @@ import {
import { okData } from "@/app/api/helpers";
import { Text } from "@/components/atoms/Text/Text";
import { ErrorCard } from "@/components/molecules/ErrorCard/ErrorCard";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useEffect } from "react";
import SettingsLoading from "./loading";
export default function SettingsPage() {
- const { user } = useSupabase();
+ const { user } = useAuth();
const {
data: preferences,
diff --git a/autogpt_platform/frontend/src/app/(platform)/reset-password/__tests__/actions.test.ts b/autogpt_platform/frontend/src/app/(platform)/reset-password/__tests__/actions.test.ts
new file mode 100644
index 0000000000..1d5a850707
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/reset-password/__tests__/actions.test.ts
@@ -0,0 +1,131 @@
+import { APIError } from "better-auth/api";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const requestPasswordResetMock = vi.fn();
+const resetPasswordMock = vi.fn();
+const redirectMock = vi.fn();
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ requestPasswordReset: (...args: unknown[]) =>
+ requestPasswordResetMock(...args),
+ resetPassword: (...args: unknown[]) => resetPasswordMock(...args),
+ },
+ },
+}));
+
+vi.mock("@sentry/nextjs", () => ({
+ withServerActionInstrumentation: (
+ _name: string,
+ _options: object,
+ fn: () => unknown,
+ ) => fn(),
+}));
+
+vi.mock("next/navigation", () => ({
+ redirect: (...args: unknown[]) => redirectMock(...args),
+}));
+
+import { changePassword, sendResetEmail } from "../actions";
+
+beforeEach(() => {
+ requestPasswordResetMock.mockReset();
+ resetPasswordMock.mockReset();
+ redirectMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+ vi.restoreAllMocks();
+});
+
+describe("sendResetEmail", () => {
+ it("requests a reset link that redirects back to the configured origin", async () => {
+ vi.stubEnv("NEXT_PUBLIC_FRONTEND_BASE_URL", "https://platform.agpt.test");
+ requestPasswordResetMock.mockResolvedValue({ status: true });
+
+ const result = await sendResetEmail("[email protected]");
+
+ expect(requestPasswordResetMock).toHaveBeenCalledWith({
+ body: {
+ email: "[email protected]",
+ redirectTo: "https://platform.agpt.test/reset-password",
+ },
+ });
+ expect(result).toBeUndefined();
+ });
+
+ it("falls back to localhost when no frontend base URL is configured", async () => {
+ vi.stubEnv("NEXT_PUBLIC_FRONTEND_BASE_URL", "");
+ requestPasswordResetMock.mockResolvedValue({ status: true });
+
+ await sendResetEmail("[email protected]");
+
+ expect(requestPasswordResetMock).toHaveBeenCalledWith({
+ body: {
+ email: "[email protected]",
+ redirectTo: "http://localhost:3000/reset-password",
+ },
+ });
+ });
+
+ it("returns the Better Auth message when the reset request fails with an APIError", async () => {
+ requestPasswordResetMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: "Email rate limit exceeded",
+ code: "RATE_LIMITED",
+ }),
+ );
+
+ const result = await sendResetEmail("[email protected]");
+
+ expect(result).toBe("Email rate limit exceeded");
+ });
+
+ it("returns a generic message when the reset request fails unexpectedly", async () => {
+ requestPasswordResetMock.mockRejectedValue(new Error("smtp down"));
+
+ const result = await sendResetEmail("[email protected]");
+
+ expect(result).toBe("Failed to send reset email. Please try again.");
+ });
+});
+
+describe("changePassword", () => {
+ it("resets the password with the token and redirects to login", async () => {
+ resetPasswordMock.mockResolvedValue({ status: true });
+
+ const result = await changePassword("new-secure-password", "token-123");
+
+ expect(resetPasswordMock).toHaveBeenCalledWith({
+ body: { newPassword: "new-secure-password", token: "token-123" },
+ });
+ expect(redirectMock).toHaveBeenCalledWith("/login");
+ expect(result).toBeUndefined();
+ });
+
+ it("returns the Better Auth message without redirecting when the token is rejected", async () => {
+ resetPasswordMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: "Invalid or expired token",
+ code: "INVALID_TOKEN",
+ }),
+ );
+
+ const result = await changePassword("new-secure-password", "bad-token");
+
+ expect(result).toBe("Invalid or expired token");
+ expect(redirectMock).not.toHaveBeenCalled();
+ });
+
+ it("returns a generic message without redirecting on unexpected failures", async () => {
+ resetPasswordMock.mockRejectedValue(new Error("db unavailable"));
+
+ const result = await changePassword("new-secure-password", "token-123");
+
+ expect(result).toBe("Failed to change password. Please try again.");
+ expect(redirectMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/reset-password/actions.ts b/autogpt_platform/frontend/src/app/(platform)/reset-password/actions.ts
index 031e728eeb..07679d6eac 100644
--- a/autogpt_platform/frontend/src/app/(platform)/reset-password/actions.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/reset-password/actions.ts
@@ -1,6 +1,7 @@
"use server";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
+import { auth } from "@/lib/auth/auth";
import * as Sentry from "@sentry/nextjs";
+import { APIError } from "better-auth/api";
import { redirect } from "next/navigation";
export async function sendResetEmail(email: string) {
@@ -8,45 +9,49 @@ export async function sendResetEmail(email: string) {
"sendResetEmail",
{},
async () => {
- const supabase = await getServerSupabase();
const origin =
process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || "http://localhost:3000";
- if (!supabase) {
- redirect("/error");
- }
-
- const { error } = await supabase.auth.resetPasswordForEmail(email, {
- redirectTo: `${origin}/api/auth/callback/reset-password`,
- });
-
- if (error) {
+ try {
+ // Better Auth emails a link that redirects to
+ // `/reset-password?token=<token>` (or `?error=...` on failure).
+ await auth.api.requestPasswordReset({
+ body: {
+ email,
+ redirectTo: `${origin}/reset-password`,
+ },
+ });
+ } catch (error) {
console.error("Error sending reset email", error);
- return error.message;
+ if (error instanceof APIError) {
+ return error.body?.message || error.message;
+ }
+ return "Failed to send reset email. Please try again.";
}
},
);
}
-export async function changePassword(password: string) {
+export async function changePassword(password: string, token: string) {
return await Sentry.withServerActionInstrumentation(
"changePassword",
{},
async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- redirect("/error");
- }
-
- const { error } = await supabase.auth.updateUser({ password });
-
- if (error) {
+ try {
+ await auth.api.resetPassword({
+ body: {
+ newPassword: password,
+ token,
+ },
+ });
+ } catch (error) {
console.error("Error changing password", error);
- return error.message;
+ if (error instanceof APIError) {
+ return error.body?.message || error.message;
+ }
+ return "Failed to change password. Please try again.";
}
- await supabase.auth.signOut({ scope: "global" });
redirect("/login");
},
);
diff --git a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
index b5c18d072d..130bc9c857 100644
--- a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
@@ -6,7 +6,6 @@ import { ExpiredLinkMessage } from "@/components/auth/ExpiredLinkMessage";
import { Form, FormField } from "@/components/__legacy__/ui/form";
import LoadingBox from "@/components/__legacy__/ui/loading";
import { useToast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { changePasswordFormSchema, sendEmailFormSchema } from "@/types/auth";
import { zodResolver } from "@hookform/resolvers/zod";
import { useRouter, useSearchParams } from "next/navigation";
@@ -16,7 +15,6 @@ import { z } from "zod";
import { changePassword, sendResetEmail } from "./actions";
function ResetPasswordContent() {
- const { supabase, user, isUserLoading } = useSupabase();
const { toast } = useToast();
const searchParams = useSearchParams();
const router = useRouter();
@@ -24,6 +22,10 @@ function ResetPasswordContent() {
const [disabled, setDisabled] = useState(false);
const [showExpiredMessage, setShowExpiredMessage] = useState(false);
+ // Better Auth's reset link lands here with `?token=`; its presence decides
+ // whether we show the "set new password" form or the "request email" form.
+ const resetToken = searchParams.get("token");
+
useEffect(() => {
const error = searchParams.get("error");
const errorCode = searchParams.get("error_code");
@@ -31,10 +33,12 @@ function ResetPasswordContent() {
if (error || errorCode) {
// Check if this is an expired/used link error
- // Avoid broad checks like "invalid" which can match unrelated errors (e.g., PKCE errors)
+ // Avoid broad checks like "invalid" which can match unrelated errors
const descLower = errorDescription?.toLowerCase() || "";
const isExpiredOrUsed =
error === "link_expired" ||
+ error === "INVALID_TOKEN" ||
+ error === "invalid_token" ||
errorCode === "otp_expired" ||
descLower.includes("expired") ||
descLower.includes("already") ||
@@ -42,7 +46,7 @@ function ResetPasswordContent() {
if (isExpiredOrUsed) {
setShowExpiredMessage(true);
- // Also show a toast with the Supabase error detail for debugging
+ // Also show a toast with the error detail for debugging
if (errorDescription) {
toast({
title: "Link Expired",
@@ -121,6 +125,8 @@ function ResetPasswordContent() {
const onChangePassword = useCallback(
async (data: z.infer<typeof changePasswordFormSchema>) => {
+ if (!resetToken) return;
+
setIsLoading(true);
if (!(await changePasswordForm.trigger())) {
@@ -128,7 +134,7 @@ function ResetPasswordContent() {
return;
}
- const error = await changePassword(data.password);
+ const error = await changePassword(data.password, resetToken);
setIsLoading(false);
if (error) {
toast({
@@ -144,23 +150,11 @@ function ResetPasswordContent() {
variant: "default",
});
},
- [changePasswordForm, toast],
+ [changePasswordForm, resetToken, toast],
);
- if (isUserLoading) {
- return <LoadingBox className="h-[80vh]" />;
- }
-
- if (!supabase) {
- return (
- <div>
- User accounts are disabled because Supabase client is unavailable
- </div>
- );
- }
-
// Show expired link message if detected
- if (showExpiredMessage && !user) {
+ if (showExpiredMessage && !resetToken) {
return (
<div className="flex h-full min-h-[85vh] w-full flex-col items-center justify-center">
<AuthCard title="Reset Password">
@@ -173,7 +167,7 @@ function ResetPasswordContent() {
return (
<div className="flex h-full min-h-[85vh] w-full flex-col items-center justify-center">
<AuthCard title="Reset Password">
- {user ? (
+ {resetToken ? (
<form
onSubmit={changePasswordForm.handleSubmit(onChangePassword)}
className="flex w-full flex-col gap-1"
@@ -218,7 +212,6 @@ function ResetPasswordContent() {
loading={isLoading}
type="submit"
className="mt-6 w-full"
- onClick={() => onChangePassword(changePasswordForm.getValues())}
>
{isLoading ? "Updating password..." : "Update password"}
</Button>
@@ -251,7 +244,6 @@ function ResetPasswordContent() {
disabled={disabled}
type="submit"
className="mt-6 w-full"
- onClick={() => onSendEmail(sendEmailForm.getValues())}
>
Send reset email
</Button>
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/account/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/account/__tests__/main.test.tsx
index eee97b716e..aad375cccd 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/account/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/account/__tests__/main.test.tsx
@@ -18,14 +18,14 @@ import {
import SettingsPreferencesPage from "../page";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
vi.mock("@/providers/onboarding/onboarding-provider", () => ({
default: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
const testUser = {
@@ -84,11 +84,10 @@ function setupBaseHandlers(
describe("SettingsPreferencesPage", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/AccountCard.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/AccountCard.tsx
index 43598615a9..c7c8612012 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/AccountCard.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/AccountCard.tsx
@@ -1,6 +1,6 @@
"use client";
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { PencilSimpleIcon } from "@phosphor-icons/react";
import { motion, useReducedMotion } from "framer-motion";
import { useState } from "react";
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/useAccountCard.ts b/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/useAccountCard.ts
index 2cade500a6..72868af2a1 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/useAccountCard.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/account/components/AccountCard/useAccountCard.ts
@@ -1,11 +1,11 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { useForm } from "react-hook-form";
import { z } from "zod";
-import { usePostV1UpdateUserEmail } from "@/app/api/__generated__/endpoints/auth/auth";
+import { useState } from "react";
import { toast } from "@/components/molecules/Toast/use-toast";
const emailSchema = z.object({
@@ -17,7 +17,7 @@ const emailSchema = z.object({
type EmailFormValues = z.infer<typeof emailSchema>;
-async function updateEmailViaSupabase(email: string) {
+async function updateEmailViaAuthAPI(email: string) {
const response = await fetch("/api/auth/user", {
method: "PUT",
headers: { "Content-Type": "application/json" },
@@ -41,21 +41,39 @@ export function useAccountCard({ user }: { user: User }) {
mode: "onChange",
});
- const updateEmailServer = usePostV1UpdateUserEmail();
+ const [isUpdatingEmail, setIsUpdatingEmail] = useState(false);
async function onSubmitEmail(values: EmailFormValues): Promise<boolean> {
if (values.email === currentEmail) return false;
+ // Route the change only through Better Auth. A verified user approves it via
+ // a confirmation link sent to their CURRENT address (anti-takeover); an
+ // unverified user's change applies immediately. Platform User.email
+ // converges via the databaseHooks.user.update mirror in lib/auth/auth.ts —
+ // writing it here in parallel would let it diverge to an unverified value.
+ // Mirrors EmailForm.
+ setIsUpdatingEmail(true);
try {
- await Promise.all([
- updateEmailViaSupabase(values.email),
- updateEmailServer.mutateAsync({ data: values.email }),
- ]);
- toast({
- title: "Email update sent",
- description: "Check your inbox to confirm the change.",
- variant: "success",
- });
+ await updateEmailViaAuthAPI(values.email);
+ // Reset to the still-current address: on the verified path the row isn't
+ // written until the link is clicked, so leaving the new value in the
+ // field would let every further click send another email. Mirrors
+ // EmailForm.
+ emailForm.reset({ email: currentEmail });
+ toast(
+ user.email_verified
+ ? {
+ title: "Confirm your new email",
+ description:
+ "We sent a confirmation link to your current email address. Your email changes once you click it.",
+ variant: "success",
+ }
+ : {
+ title: "Email updated",
+ description: `Your email is now ${values.email}.`,
+ variant: "success",
+ },
+ );
return true;
} catch (err) {
toast({
@@ -64,13 +82,15 @@ export function useAccountCard({ user }: { user: User }) {
variant: "destructive",
});
return false;
+ } finally {
+ setIsUpdatingEmail(false);
}
}
return {
emailForm,
onSubmitEmail,
- isUpdatingEmail: updateEmailServer.isPending,
+ isUpdatingEmail,
currentEmail,
};
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/account/usePreferencesPage.ts b/autogpt_platform/frontend/src/app/(platform)/settings/account/usePreferencesPage.ts
index c27c1d4419..956d6d3cd7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/account/usePreferencesPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/account/usePreferencesPage.ts
@@ -14,7 +14,7 @@ import {
import type { UpdateTimezoneRequestTimezone } from "@/app/api/__generated__/models/updateTimezoneRequestTimezone";
import { okData } from "@/app/api/helpers";
import { toast } from "@/components/molecules/Toast/use-toast";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import {
detectBrowserTimezone,
@@ -41,7 +41,7 @@ const EMPTY_FLAGS: NotificationFlags = {
};
export function usePreferencesPage() {
- const { user } = useSupabase();
+ const { user } = useAuth();
const queryClient = useQueryClient();
const preferencesQuery = useGetV1GetNotificationPreferences({
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx
index 6d7b373447..c5c9cbb7d3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/main.test.tsx
@@ -19,10 +19,10 @@ import {
import SettingsCreatorDashboardPage from "../page";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@/components/contextual/PublishAgentModal/PublishAgentModal", () => ({
@@ -154,11 +154,10 @@ function makeResponse(
describe("SettingsCreatorDashboardPage", () => {
beforeEach(() => {
toastSpy.mockClear();
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx
index 113bb2a1a4..a5796d704f 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/__tests__/search.test.tsx
@@ -16,10 +16,10 @@ import {
import SettingsCreatorDashboardPage from "../page";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@/components/contextual/PublishAgentModal/PublishAgentModal", () => ({
@@ -93,11 +93,10 @@ function makeResponse(
describe("creator-dashboard search", () => {
beforeEach(() => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: testUser,
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
});
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts
index df30fefd79..b0268741d1 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/creator-dashboard/useCreatorDashboardPage.ts
@@ -13,7 +13,7 @@ import type { StoreSubmission } from "@/app/api/__generated__/models/storeSubmis
import type { StoreSubmissionsResponse } from "@/app/api/__generated__/models/storeSubmissionsResponse";
import { useDebouncedValue } from "@/hooks/useDebouncedValue";
import { getQueryClient } from "@/lib/react-query/queryClient";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import type { PublishState } from "@/components/contextual/PublishAgentModal/usePublishAgentModal";
import {
@@ -34,7 +34,7 @@ interface EditState {
export function useCreatorDashboardPage() {
const queryClient = getQueryClient();
- const { user } = useSupabase();
+ const { user } = useAuth();
const [publishState, setPublishState] = useState<PublishState>({
isOpen: false,
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/profile/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/profile/__tests__/main.test.tsx
index 34a9f6f9d4..458af869c3 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/profile/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/profile/__tests__/main.test.tsx
@@ -19,12 +19,12 @@ import type { ProfileDetails } from "@/app/api/__generated__/models/profileDetai
import SettingsProfilePage from "../page";
-const mockUseSupabase = vi.hoisted(() => vi.fn());
+const mockUseAuth = vi.hoisted(() => vi.fn());
const toastSpy = vi.hoisted(() => vi.fn());
const uploadAvatarSpy = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: mockUseSupabase,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: mockUseAuth,
}));
vi.mock("@/lib/direct-upload", async (importOriginal) => {
@@ -59,7 +59,7 @@ function makeProfile(overrides: Partial<ProfileDetails> = {}): ProfileDetails {
}
function authenticate() {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: {
id: "user-1",
@@ -70,7 +70,6 @@ function authenticate() {
},
isLoggedIn: true,
isUserLoading: false,
- supabase: {},
});
}
@@ -686,11 +685,10 @@ describe("SettingsProfilePage - avatar upload", () => {
describe("SettingsProfilePage - skeleton & nullish profile fields", () => {
test("renders the skeleton on first render before the user resolves", () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: null,
isLoggedIn: false,
isUserLoading: true,
- supabase: {},
});
const { container } = render(<SettingsProfilePage />);
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/profile/useProfilePage.ts b/autogpt_platform/frontend/src/app/(platform)/settings/profile/useProfilePage.ts
index 4594d46ae2..b10dbef286 100644
--- a/autogpt_platform/frontend/src/app/(platform)/settings/profile/useProfilePage.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/profile/useProfilePage.ts
@@ -16,7 +16,7 @@ import {
uploadSubmissionMediaDirect,
} from "@/lib/direct-upload";
import { ApiError, isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import {
isFormDirty,
@@ -36,7 +36,7 @@ const EMPTY_FORM: ProfileFormState = {
};
export function useProfilePage() {
- const { user } = useSupabase();
+ const { user } = useAuth();
const queryClient = useQueryClient();
const logoutInProgress = isLogoutInProgress();
diff --git a/autogpt_platform/frontend/src/app/api/auth/[...all]/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/api/auth/[...all]/__tests__/route.test.ts
new file mode 100644
index 0000000000..ce20620d98
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/api/auth/[...all]/__tests__/route.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it, vi } from "vitest";
+
+// The route module invokes toNextJsHandler while it is being imported, so the
+// mocks must exist before the hoisted import executes.
+const {
+ getHandlerSentinel,
+ postHandlerSentinel,
+ toNextJsHandlerMock,
+ authInstance,
+} = vi.hoisted(() => {
+ const getHandlerSentinel = vi.fn();
+ const postHandlerSentinel = vi.fn();
+ return {
+ getHandlerSentinel,
+ postHandlerSentinel,
+ toNextJsHandlerMock: vi.fn(() => ({
+ GET: getHandlerSentinel,
+ POST: postHandlerSentinel,
+ })),
+ authInstance: { handler: "better-auth-instance" },
+ };
+});
+
+vi.mock("better-auth/next-js", () => ({
+ toNextJsHandler: toNextJsHandlerMock,
+}));
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: authInstance,
+}));
+
+import { GET, POST } from "../route";
+
+describe("auth catch-all route", () => {
+ it("exposes the Better Auth Next.js handlers built from the auth instance", () => {
+ expect(toNextJsHandlerMock).toHaveBeenCalledWith(authInstance);
+ expect(GET).toBe(getHandlerSentinel);
+ expect(POST).toBe(postHandlerSentinel);
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/api/auth/[...all]/route.ts b/autogpt_platform/frontend/src/app/api/auth/[...all]/route.ts
new file mode 100644
index 0000000000..86844429c7
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/api/auth/[...all]/route.ts
@@ -0,0 +1,4 @@
+import { auth } from "@/lib/auth/auth";
+import { toNextJsHandler } from "better-auth/next-js";
+
+export const { GET, POST } = toNextJsHandler(auth);
diff --git a/autogpt_platform/frontend/src/app/api/auth/callback/reset-password/route.ts b/autogpt_platform/frontend/src/app/api/auth/callback/reset-password/route.ts
deleted file mode 100644
index 0ca5642bab..0000000000
--- a/autogpt_platform/frontend/src/app/api/auth/callback/reset-password/route.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { exchangePasswordResetCode } from "@/lib/supabase/helpers";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
-import { NextRequest, NextResponse } from "next/server";
-
-export async function GET(request: NextRequest) {
- const { searchParams } = new URL(request.url);
- const code = searchParams.get("code");
- const origin =
- process.env.NEXT_PUBLIC_FRONTEND_BASE_URL || "http://localhost:3000";
-
- if (!code) {
- // Supabase may redirect here with error params instead of a code
- // (e.g. when the OTP token is expired or already used)
- const error = searchParams.get("error");
- const errorCode = searchParams.get("error_code");
- const errorDescription = searchParams.get("error_description");
-
- if (error || errorCode || errorDescription) {
- // Forward raw Supabase error params to the reset-password page,
- // which already handles classification (expired vs other errors)
- const params = new URLSearchParams();
- if (error) params.set("error", error);
- if (errorCode) params.set("error_code", errorCode);
- if (errorDescription) params.set("error_description", errorDescription);
-
- return NextResponse.redirect(
- `${origin}/reset-password?${params.toString()}`,
- );
- }
-
- return NextResponse.redirect(
- `${origin}/reset-password?error=${encodeURIComponent("Missing verification code")}`,
- );
- }
-
- try {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return NextResponse.redirect(
- `${origin}/reset-password?error=no-auth-client`,
- );
- }
-
- const result = await exchangePasswordResetCode(supabase, code);
-
- if (!result.success) {
- // Check for expired or used link errors
- // Avoid broad checks like "invalid" which can match unrelated errors (e.g., PKCE errors)
- const errorMessage = result.error?.toLowerCase() || "";
- const isExpiredOrUsed =
- errorMessage.includes("expired") ||
- errorMessage.includes("otp_expired") ||
- errorMessage.includes("already") ||
- errorMessage.includes("used");
-
- const errorParam = isExpiredOrUsed
- ? "link_expired"
- : encodeURIComponent(result.error || "Password reset failed");
-
- return NextResponse.redirect(
- `${origin}/reset-password?error=${errorParam}`,
- );
- }
-
- return NextResponse.redirect(`${origin}/reset-password`);
- } catch (error) {
- console.error("Password reset callback error:", error);
- return NextResponse.redirect(
- `${origin}/reset-password?error=${encodeURIComponent("Password reset failed")}`,
- );
- }
-}
diff --git a/autogpt_platform/frontend/src/app/api/auth/login/with-provider/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/api/auth/login/with-provider/__tests__/route.test.ts
new file mode 100644
index 0000000000..acb337a98a
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/api/auth/login/with-provider/__tests__/route.test.ts
@@ -0,0 +1,168 @@
+import { APIError } from "better-auth/api";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const signInSocialMock = vi.fn();
+const isWaitlistErrorMock = vi.fn();
+const logWaitlistErrorMock = vi.fn();
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ signInSocial: (...args: unknown[]) => signInSocialMock(...args),
+ },
+ },
+}));
+
+vi.mock("@/app/api/auth/utils", () => ({
+ isWaitlistError: (...args: unknown[]) => isWaitlistErrorMock(...args),
+ logWaitlistError: (...args: unknown[]) => logWaitlistErrorMock(...args),
+}));
+
+import { POST } from "../route";
+
+function makeProviderRequest(body: unknown): Request {
+ return new Request("http://localhost:3000/api/auth/login/with-provider", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify(body),
+ });
+}
+
+beforeEach(() => {
+ signInSocialMock.mockReset();
+ isWaitlistErrorMock.mockReset().mockReturnValue(false);
+ logWaitlistErrorMock.mockReset();
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+ vi.restoreAllMocks();
+});
+
+describe("POST /api/auth/login/with-provider", () => {
+ it("returns the social sign-in URL and forwards redirectTo as the callback URL", async () => {
+ signInSocialMock.mockResolvedValue({
+ url: "https://accounts.google.com/o/oauth2/auth?state=xyz",
+ });
+
+ const request = makeProviderRequest({
+ provider: "google",
+ redirectTo: "/auth/callback?next=/marketplace",
+ });
+ const response = await POST(request);
+
+ expect(signInSocialMock).toHaveBeenCalledWith({
+ body: {
+ provider: "google",
+ callbackURL: "/auth/callback?next=/marketplace",
+ },
+ headers: request.headers,
+ });
+ expect(response.status).toBe(200);
+ expect(await response.json()).toEqual({
+ url: "https://accounts.google.com/o/oauth2/auth?state=xyz",
+ });
+ });
+
+ it("falls back to the default callback URL when redirectTo is omitted", async () => {
+ vi.stubEnv("AUTH_CALLBACK_URL", "");
+ signInSocialMock.mockResolvedValue({ url: "https://github.com/oauth" });
+
+ await POST(makeProviderRequest({ provider: "github" }));
+
+ expect(signInSocialMock).toHaveBeenCalledWith({
+ body: { provider: "github", callbackURL: "/auth/callback" },
+ headers: expect.any(Headers),
+ });
+ });
+
+ it("returns 400 when no provider is supplied", async () => {
+ const response = await POST(makeProviderRequest({ redirectTo: "/x" }));
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "Invalid provider" });
+ expect(signInSocialMock).not.toHaveBeenCalled();
+ });
+
+ it("returns 403 not_allowed for waitlist rejections", async () => {
+ isWaitlistErrorMock.mockReturnValue(true);
+ signInSocialMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: 'The email address "[email]" is not allowed to register.',
+ code: "P0001",
+ }),
+ );
+
+ const response = await POST(makeProviderRequest({ provider: "google" }));
+
+ expect(response.status).toBe(403);
+ expect(await response.json()).toEqual({ error: "not_allowed" });
+ expect(logWaitlistErrorMock).toHaveBeenCalledWith(
+ "OAuth Provider",
+ expect.any(String),
+ );
+ });
+
+ it("matches the waitlist gate on the body message, not the status-shaped error.message", async () => {
+ isWaitlistErrorMock.mockReturnValue(true);
+ const gateError = new APIError("FORBIDDEN", {
+ message: "Signups are not allowed.",
+ });
+ // At runtime auth.api surfaces the status as error.message while the
+ // gate's reason lives in body.message; model that split so this test
+ // fails if the route ever matches on error.message again.
+ Object.defineProperty(gateError, "message", { value: "FORBIDDEN" });
+ signInSocialMock.mockRejectedValue(gateError);
+
+ const response = await POST(makeProviderRequest({ provider: "google" }));
+
+ expect(response.status).toBe(403);
+ expect(isWaitlistErrorMock).toHaveBeenCalledWith(
+ undefined,
+ "Signups are not allowed.",
+ );
+ });
+
+ it("returns 400 with the Better Auth message for other APIErrors", async () => {
+ signInSocialMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: "Provider not configured",
+ code: "PROVIDER_NOT_FOUND",
+ }),
+ );
+
+ const response = await POST(makeProviderRequest({ provider: "discord" }));
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "Provider not configured" });
+ });
+
+ it("returns 500 when sign-in fails with an unexpected error", async () => {
+ signInSocialMock.mockRejectedValue(new Error("connection refused"));
+
+ const response = await POST(makeProviderRequest({ provider: "google" }));
+
+ expect(response.status).toBe(500);
+ expect(await response.json()).toEqual({
+ error: "Failed to initiate OAuth",
+ });
+ });
+
+ it("returns 400 when the request body is not valid JSON", async () => {
+ const request = new Request(
+ "http://localhost:3000/api/auth/login/with-provider",
+ {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: "{not json",
+ },
+ );
+
+ const response = await POST(request);
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({
+ error: "Invalid JSON body",
+ });
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/api/auth/login/with-provider/route.ts b/autogpt_platform/frontend/src/app/api/auth/login/with-provider/route.ts
new file mode 100644
index 0000000000..e6e36a7dbf
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/api/auth/login/with-provider/route.ts
@@ -0,0 +1,61 @@
+import { auth } from "@/lib/auth/auth";
+import { LoginProvider } from "@/types/auth";
+import { APIError } from "better-auth/api";
+import { NextResponse } from "next/server";
+import { isWaitlistError, logWaitlistError } from "../../utils";
+
+export async function POST(request: Request) {
+ let body: { provider?: LoginProvider; redirectTo?: string };
+ try {
+ body = await request.json();
+ } catch {
+ // A malformed body is the caller's mistake, not ours — reporting 500 would
+ // put client syntax errors in our server-error telemetry and invite retries.
+ return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 });
+ }
+
+ try {
+ const provider: LoginProvider | undefined = body?.provider;
+ const redirectTo: string | undefined = body?.redirectTo;
+
+ if (!provider) {
+ return NextResponse.json({ error: "Invalid provider" }, { status: 400 });
+ }
+
+ try {
+ const { url } = await auth.api.signInSocial({
+ body: {
+ provider,
+ callbackURL:
+ redirectTo || process.env.AUTH_CALLBACK_URL || "/auth/callback",
+ },
+ headers: request.headers,
+ });
+
+ return NextResponse.json({ url });
+ } catch (error) {
+ if (error instanceof APIError) {
+ // Match on the body message ("Signups are not allowed."), not
+ // error.message — the latter is the status ("FORBIDDEN"), which never
+ // matches the waitlist patterns (same trap as the email signup path).
+ if (isWaitlistError(error.body?.code, error.body?.message)) {
+ logWaitlistError("OAuth Provider", error.message);
+ return NextResponse.json({ error: "not_allowed" }, { status: 403 });
+ }
+
+ // Preserve Better Auth's status so callers can tell throttling (429)
+ // or auth failure (401) apart from a bad request.
+ return NextResponse.json(
+ { error: error.body?.message || error.message },
+ { status: error.statusCode ?? 400 },
+ );
+ }
+ throw error;
+ }
+ } catch {
+ return NextResponse.json(
+ { error: "Failed to initiate OAuth" },
+ { status: 500 },
+ );
+ }
+}
diff --git a/autogpt_platform/frontend/src/app/api/auth/provider/route.ts b/autogpt_platform/frontend/src/app/api/auth/provider/route.ts
deleted file mode 100644
index d7cfecfaf6..0000000000
--- a/autogpt_platform/frontend/src/app/api/auth/provider/route.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
-import { NextResponse } from "next/server";
-import { LoginProvider } from "@/types/auth";
-import { isWaitlistError, logWaitlistError } from "../utils";
-
-export async function POST(request: Request) {
- try {
- const body = await request.json();
- const provider: LoginProvider | undefined = body?.provider;
- const redirectTo: string | undefined = body?.redirectTo;
-
- if (!provider) {
- return NextResponse.json({ error: "Invalid provider" }, { status: 400 });
- }
-
- const supabase = await getServerSupabase();
- if (!supabase) {
- return NextResponse.json(
- { error: "Authentication service unavailable" },
- { status: 500 },
- );
- }
-
- const { data, error } = await supabase.auth.signInWithOAuth({
- provider,
- options: {
- redirectTo:
- redirectTo ||
- process.env.AUTH_CALLBACK_URL ||
- `http://localhost:3000/auth/callback`,
- },
- });
-
- if (error) {
- // Check for waitlist/allowlist error
- if (isWaitlistError(error?.code, error?.message)) {
- logWaitlistError("OAuth Provider", error.message);
- return NextResponse.json({ error: "not_allowed" }, { status: 403 });
- }
-
- return NextResponse.json({ error: error.message }, { status: 400 });
- }
-
- return NextResponse.json({ url: data?.url });
- } catch {
- return NextResponse.json(
- { error: "Failed to initiate OAuth" },
- { status: 500 },
- );
- }
-}
diff --git a/autogpt_platform/frontend/src/app/api/auth/user/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/api/auth/user/__tests__/route.test.ts
index 9f1be00f12..a0f4cb6372 100644
--- a/autogpt_platform/frontend/src/app/api/auth/user/__tests__/route.test.ts
+++ b/autogpt_platform/frontend/src/app/api/auth/user/__tests__/route.test.ts
@@ -1,54 +1,223 @@
-import { beforeEach, describe, expect, it, vi } from "vitest";
+import { APIError } from "better-auth/api";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-const mockUpdateUser = vi.hoisted(() =>
- vi.fn(() => Promise.resolve({ data: { user: { id: "u1" } }, error: null })),
-);
+const getServerSessionMock = vi.fn();
+const updateUserMock = vi.fn();
+const changeEmailMock = vi.fn();
+const getSessionMock = vi.fn();
-vi.mock("@/lib/supabase/server/getServerSupabase", () => ({
- getServerSupabase: () =>
- Promise.resolve({ auth: { updateUser: mockUpdateUser } }),
+vi.mock("@/lib/auth/server/getServerSession", () => ({
+ getServerSession: () => getServerSessionMock(),
}));
-import { PUT } from "../route";
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ updateUser: (...args: unknown[]) => updateUserMock(...args),
+ changeEmail: (...args: unknown[]) => changeEmailMock(...args),
+ getSession: (...args: unknown[]) => getSessionMock(...args),
+ },
+ },
+}));
+
+import { GET, PUT } from "../route";
+
+const sessionUser = {
+ id: "user-1",
+ email: "[email protected]",
+ name: "Test User",
+ role: "user",
+ createdAt: "2026-01-02T03:04:05.000Z",
+};
-function makeRequest(body: unknown) {
- return new Request("http://localhost/api/auth/user", {
+const mappedUser = {
+ id: "user-1",
+ email: "[email protected]",
+ role: "authenticated",
+ created_at: "2026-01-02T03:04:05.000Z",
+ user_metadata: { name: "Test User", email: "[email protected]" },
+};
+
+function makePutRequest(body: string): Request {
+ return new Request("http://localhost:3000/api/auth/user", {
method: "PUT",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify(body),
+ headers: { "content-type": "application/json" },
+ body,
});
}
+beforeEach(() => {
+ getServerSessionMock.mockReset();
+ updateUserMock.mockReset();
+ changeEmailMock.mockReset();
+ getSessionMock.mockReset();
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("GET /api/auth/user", () => {
+ it("returns the compat-shaped user for an active session", async () => {
+ getServerSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const response = await GET();
+
+ expect(response.status).toBe(200);
+ expect(await response.json()).toEqual({ user: mappedUser });
+ });
+
+ it("returns 400 with an error when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const response = await GET();
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "No active session" });
+ });
+});
+
describe("PUT /api/auth/user", () => {
- beforeEach(() => {
- mockUpdateUser.mockClear();
+ it("updates the display name via Better Auth and returns the refreshed user", async () => {
+ updateUserMock.mockResolvedValue({ status: true });
+ getSessionMock.mockResolvedValue({
+ user: { ...sessionUser, name: "New Name" },
+ });
+
+ const request = makePutRequest(JSON.stringify({ full_name: "New Name" }));
+ const response = await PUT(request);
+
+ expect(updateUserMock).toHaveBeenCalledWith({
+ body: { name: "New Name" },
+ headers: request.headers,
+ });
+ expect(changeEmailMock).not.toHaveBeenCalled();
+ expect(response.status).toBe(200);
+ expect(await response.json()).toEqual({
+ user: {
+ ...mappedUser,
+ user_metadata: { ...mappedUser.user_metadata, name: "New Name" },
+ },
+ });
+ });
+
+ it("updates the trimmed preferred name via Better Auth", async () => {
+ updateUserMock.mockResolvedValue({ status: true });
+ getSessionMock.mockResolvedValue({
+ user: { ...sessionUser, preferredName: "Rein" },
+ });
+
+ const request = makePutRequest(
+ JSON.stringify({ preferred_name: " Rein " }),
+ );
+ const response = await PUT(request);
+
+ expect(updateUserMock).toHaveBeenCalledWith({
+ body: { preferredName: "Rein" },
+ headers: request.headers,
+ });
+ expect(changeEmailMock).not.toHaveBeenCalled();
+ expect(response.status).toBe(200);
+ expect(await response.json()).toEqual({
+ user: {
+ ...mappedUser,
+ user_metadata: {
+ ...mappedUser.user_metadata,
+ preferred_name: "Rein",
+ },
+ },
+ });
+ });
+
+ it("sends name and preferred name in one Better Auth update", async () => {
+ updateUserMock.mockResolvedValue({ status: true });
+ getSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const request = makePutRequest(
+ JSON.stringify({ full_name: "Jane Doe", preferred_name: "Jane" }),
+ );
+ const response = await PUT(request);
+
+ expect(updateUserMock).toHaveBeenCalledWith({
+ body: { name: "Jane Doe", preferredName: "Jane" },
+ headers: request.headers,
+ });
+ expect(response.status).toBe(200);
});
- it("updates preferred_name metadata", async () => {
- const res = await PUT(makeRequest({ preferred_name: " Rein " }));
- expect(res.status).toBe(200);
- expect(mockUpdateUser).toHaveBeenCalledWith({
- data: { preferred_name: "Rein" },
+ it("changes the email via Better Auth when only email is provided", async () => {
+ changeEmailMock.mockResolvedValue({ status: true });
+ getSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const request = makePutRequest(
+ JSON.stringify({ email: "[email protected]" }),
+ );
+ const response = await PUT(request);
+
+ expect(changeEmailMock).toHaveBeenCalledWith({
+ body: { newEmail: "[email protected]" },
+ headers: request.headers,
});
+ expect(updateUserMock).not.toHaveBeenCalled();
+ expect(response.status).toBe(200);
});
- it("still updates full_name metadata", async () => {
- const res = await PUT(makeRequest({ full_name: "Jane Doe" }));
- expect(res.status).toBe(200);
- expect(mockUpdateUser).toHaveBeenCalledWith({
- data: { full_name: "Jane Doe" },
+ it("returns 400 when no supported field is provided", async () => {
+ const response = await PUT(
+ makePutRequest(JSON.stringify({ something: "else" })),
+ );
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({
+ error: "Email, full_name or preferred_name is required",
});
+ expect(updateUserMock).not.toHaveBeenCalled();
+ expect(changeEmailMock).not.toHaveBeenCalled();
+ });
+
+ it("returns 400 when the request body is not valid JSON", async () => {
+ const response = await PUT(makePutRequest("{not json"));
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "Invalid JSON body" });
+ });
+
+ it("passes the Better Auth APIError message through as a 400", async () => {
+ updateUserMock.mockRejectedValue(
+ new APIError("BAD_REQUEST", {
+ message: "Name is too long",
+ code: "INVALID_NAME",
+ }),
+ );
+
+ const response = await PUT(
+ makePutRequest(JSON.stringify({ full_name: "New Name" })),
+ );
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "Name is too long" });
});
- it("still updates email", async () => {
- const res = await PUT(makeRequest({ email: "[email protected]" }));
- expect(res.status).toBe(200);
- expect(mockUpdateUser).toHaveBeenCalledWith({ email: "[email protected]" });
+ it("returns 400 when the session disappears after the update", async () => {
+ updateUserMock.mockResolvedValue({ status: true });
+ getSessionMock.mockResolvedValue(null);
+
+ const response = await PUT(
+ makePutRequest(JSON.stringify({ full_name: "New Name" })),
+ );
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toEqual({ error: "No active session" });
});
- it("rejects a body without any supported field", async () => {
- const res = await PUT(makeRequest({ something: "else" }));
- expect(res.status).toBe(400);
- expect(mockUpdateUser).not.toHaveBeenCalled();
+ it("returns 500 when an unexpected error escapes the auth update", async () => {
+ updateUserMock.mockRejectedValue(new Error("db connection lost"));
+
+ const response = await PUT(
+ makePutRequest(JSON.stringify({ full_name: "New Name" })),
+ );
+
+ expect(response.status).toBe(500);
+ expect(await response.json()).toEqual({ error: "Failed to update user" });
});
});
diff --git a/autogpt_platform/frontend/src/app/api/auth/user/route.ts b/autogpt_platform/frontend/src/app/api/auth/user/route.ts
index a78f61cfd5..8cc032b35b 100644
--- a/autogpt_platform/frontend/src/app/api/auth/user/route.ts
+++ b/autogpt_platform/frontend/src/app/api/auth/user/route.ts
@@ -1,21 +1,21 @@
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
+import { auth } from "@/lib/auth/auth";
+import { getServerSession } from "@/lib/auth/server/getServerSession";
+import { mapSessionUser } from "@/lib/auth/types";
+import { APIError } from "better-auth/api";
import { NextResponse } from "next/server";
export async function GET() {
- const supabase = await getServerSupabase();
- const { data, error } = await supabase.auth.getUser();
+ const session = await getServerSession();
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 400 });
+ if (!session?.user) {
+ return NextResponse.json({ error: "No active session" }, { status: 400 });
}
- return NextResponse.json(data);
+ return NextResponse.json({ user: mapSessionUser(session.user) });
}
export async function PUT(request: Request) {
try {
- const supabase = await getServerSupabase();
-
let body: unknown;
try {
body = await request.json();
@@ -48,22 +48,55 @@ export async function PUT(request: Request) {
);
}
- const updatePayload: Parameters<typeof supabase.auth.updateUser>[0] = {};
- if (email) updatePayload.email = email;
- if (fullName || preferredName) {
- updatePayload.data = {
- ...(fullName && { full_name: fullName }),
- ...(preferredName && { preferred_name: preferredName }),
- };
+ // The two writes below can't be made atomic: the profile update commits
+ // immediately while the email change is a separate, verification-gated
+ // flow. Combining them means a failing email change (e.g. "Email is the
+ // same") reports 400 for the whole request even though the name was
+ // already saved, and the client won't refetch. Reject the combination
+ // instead of silently half-applying it.
+ if (email && (fullName || preferredName)) {
+ return NextResponse.json(
+ { error: "Update email separately from profile fields" },
+ { status: 400 },
+ );
+ }
+
+ try {
+ if (fullName || preferredName) {
+ await auth.api.updateUser({
+ body: {
+ ...(fullName && { name: fullName }),
+ ...(preferredName && { preferredName }),
+ },
+ headers: request.headers,
+ });
+ }
+ if (email) {
+ await auth.api.changeEmail({
+ body: { newEmail: email },
+ headers: request.headers,
+ });
+ }
+ } catch (error) {
+ if (error instanceof APIError) {
+ return NextResponse.json(
+ { error: error.body?.message || error.message },
+ { status: 400 },
+ );
+ }
+ throw error;
}
- const { data, error } = await supabase.auth.updateUser(updatePayload);
+ const session = await auth.api.getSession({
+ headers: request.headers,
+ query: { disableCookieCache: true },
+ });
- if (error) {
- return NextResponse.json({ error: error.message }, { status: 400 });
+ if (!session?.user) {
+ return NextResponse.json({ error: "No active session" }, { status: 400 });
}
- return NextResponse.json(data);
+ return NextResponse.json({ user: mapSessionUser(session.user) });
} catch {
return NextResponse.json(
{ error: "Failed to update user" },
diff --git a/autogpt_platform/frontend/src/app/api/chat/sessions/[sessionId]/stream/route.ts b/autogpt_platform/frontend/src/app/api/chat/sessions/[sessionId]/stream/route.ts
index 269c322c82..bbdf933227 100644
--- a/autogpt_platform/frontend/src/app/api/chat/sessions/[sessionId]/stream/route.ts
+++ b/autogpt_platform/frontend/src/app/api/chat/sessions/[sessionId]/stream/route.ts
@@ -1,5 +1,5 @@
import { environment } from "@/services/environment";
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { NextRequest } from "next/server";
import { normalizeSSEStream, SSE_HEADERS } from "../../../sse-helpers";
@@ -11,12 +11,34 @@ const DEBUG_SSE_TIMEOUT_MS = process.env.NEXT_PUBLIC_SSE_TIMEOUT_MS
? Number(process.env.NEXT_PUBLIC_SSE_TIMEOUT_MS)
: undefined;
-function debugSignal(): AbortSignal | undefined {
- if (!DEBUG_SSE_TIMEOUT_MS) return undefined;
- console.warn(
- `[SSE_DEBUG] Simulating proxy timeout in ${DEBUG_SSE_TIMEOUT_MS}ms`,
- );
- return AbortSignal.timeout(DEBUG_SSE_TIMEOUT_MS);
+// Bounds the time to ESTABLISH the backend stream (time-to-first-response), so
+// a hung connection can't leave the client spinner waiting forever. It is
+// cleared the moment response headers arrive, so it never truncates a healthy
+// long-lived SSE stream — maxDuration still caps the total stream duration.
+const STREAM_CONNECT_TIMEOUT_MS = 30_000;
+
+async function fetchStream(url: string, init: RequestInit): Promise<Response> {
+ // Debug/testing hook: NEXT_PUBLIC_SSE_TIMEOUT_MS aborts the ENTIRE stream to
+ // simulate a mid-stream proxy timeout.
+ if (DEBUG_SSE_TIMEOUT_MS) {
+ console.warn(
+ `[SSE_DEBUG] Simulating proxy timeout in ${DEBUG_SSE_TIMEOUT_MS}ms`,
+ );
+ return fetch(url, {
+ ...init,
+ signal: AbortSignal.timeout(DEBUG_SSE_TIMEOUT_MS),
+ });
+ }
+
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), STREAM_CONNECT_TIMEOUT_MS);
+ try {
+ return await fetch(url, { ...init, signal: controller.signal });
+ } finally {
+ // Headers arrived (or the request already failed); stop guarding so the
+ // streamed body runs for the full maxDuration window.
+ clearTimeout(timer);
+ }
}
export async function POST(
@@ -55,7 +77,7 @@ export async function POST(
headers["Authorization"] = `Bearer ${token}`;
}
- const response = await fetch(streamUrl.toString(), {
+ const response = await fetchStream(streamUrl.toString(), {
method: "POST",
headers,
body: JSON.stringify({
@@ -64,7 +86,6 @@ export async function POST(
context: context || null,
file_ids: file_ids || null,
}),
- signal: debugSignal(),
});
if (!response.ok) {
@@ -125,10 +146,9 @@ export async function GET(
headers["Authorization"] = `Bearer ${token}`;
}
- const response = await fetch(streamUrl.toString(), {
+ const response = await fetchStream(streamUrl.toString(), {
method: "GET",
headers,
- signal: debugSignal(),
});
if (response.status === 204) {
diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.json
index 047f9e04b5..1cc79270ac 100644
--- a/autogpt_platform/frontend/src/app/api/openapi.json
+++ b/autogpt_platform/frontend/src/app/api/openapi.json
@@ -2569,6 +2569,45 @@
}
}
},
+ "/api/auth/email/send": {
+ "post": {
+ "tags": ["auth-email"],
+ "summary": "Send a Better Auth transactional email via the backend mailer",
+ "operationId": "sendAuthTransactionalEmail",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/AuthEmailRequest" }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "204": { "description": "Successful Response" },
+ "400": {
+ "description": "url does not point at a trusted frontend origin"
+ },
+ "401": {
+ "$ref": "#/components/responses/HTTP401NotAuthenticatedError"
+ },
+ "403": {
+ "description": "Service token is missing the required scope"
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
+ }
+ }
+ },
+ "503": {
+ "description": "Service-token verification is not configured"
+ }
+ },
+ "security": [{ "HTTPBearerJWT": [] }]
+ }
+ },
"/api/auth/user": {
"post": {
"tags": ["v1", "auth"],
@@ -13812,6 +13851,20 @@
"required": ["answer", "documents", "success"],
"title": "ApiResponse"
},
+ "AuthEmailRequest": {
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": ["reset_password", "verify_email", "change_email"],
+ "title": "Type"
+ },
+ "to": { "type": "string", "format": "email", "title": "To" },
+ "url": { "type": "string", "title": "Url" }
+ },
+ "type": "object",
+ "required": ["type", "to", "url"],
+ "title": "AuthEmailRequest"
+ },
"AuthorizeRequest": {
"properties": {
"client_id": {
diff --git a/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.helpers.test.ts b/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.helpers.test.ts
index 172efb4c86..0d9af07ee1 100644
--- a/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.helpers.test.ts
+++ b/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.helpers.test.ts
@@ -6,6 +6,8 @@ import {
getWorkspaceDownloadErrorMessage,
fetchWorkspaceDownloadOnce,
fetchWorkspaceDownloadWithRetry,
+ watchResponseStart,
+ RESPONSE_START_TIMEOUT_MS,
} from "../route.helpers";
describe("isWorkspaceDownloadRequest", () => {
@@ -954,3 +956,71 @@ describe("fetchWorkspaceDownloadWithRetry", () => {
expect(fetch).toHaveBeenCalledTimes(2);
});
});
+
+describe("watchResponseStart", () => {
+ beforeEach(() => {
+ vi.useFakeTimers();
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ it("aborts with TimeoutError when a bodyless request gets no response in time", () => {
+ const watch = watchResponseStart(null);
+
+ expect(watch.body).toBeUndefined();
+ expect(watch.signal.aborted).toBe(false);
+
+ vi.advanceTimersByTime(RESPONSE_START_TIMEOUT_MS + 1);
+
+ expect(watch.signal.aborted).toBe(true);
+ expect((watch.signal.reason as DOMException).name).toBe("TimeoutError");
+ });
+
+ it("does not abort once cleared (backend started responding)", () => {
+ const watch = watchResponseStart(null);
+
+ watch.clear();
+ vi.advanceTimersByTime(RESPONSE_START_TIMEOUT_MS * 2);
+
+ expect(watch.signal.aborted).toBe(false);
+ });
+
+ it("does not start the clock while the request body is still uploading", async () => {
+ const requestBody = new ReadableStream({
+ start(controller) {
+ controller.enqueue(new TextEncoder().encode("chunk"));
+ // Never closed: the upload is still in progress.
+ },
+ });
+
+ const watch = watchResponseStart(requestBody);
+
+ vi.advanceTimersByTime(RESPONSE_START_TIMEOUT_MS * 10);
+
+ expect(watch.signal.aborted).toBe(false);
+ });
+
+ it("arms only after the request body has been fully consumed", async () => {
+ const requestBody = new ReadableStream({
+ start(controller) {
+ controller.enqueue(new TextEncoder().encode("chunk"));
+ controller.close();
+ },
+ });
+
+ const watch = watchResponseStart(requestBody);
+
+ const reader = watch.body!.getReader();
+ while (!(await reader.read()).done) {
+ // Drain, as fetch would while uploading to the backend.
+ }
+
+ expect(watch.signal.aborted).toBe(false);
+ vi.advanceTimersByTime(RESPONSE_START_TIMEOUT_MS + 1);
+
+ expect(watch.signal.aborted).toBe(true);
+ expect((watch.signal.reason as DOMException).name).toBe("TimeoutError");
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.test.ts
index b480695263..d8e6d9f7c2 100644
--- a/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.test.ts
+++ b/autogpt_platform/frontend/src/app/api/proxy/[...path]/__tests__/route.test.ts
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
-vi.mock("@/lib/autogpt-server-api/helpers", () => ({
+vi.mock("@/lib/auth/server/getServerAuthToken", () => ({
getServerAuthToken: vi.fn(),
}));
@@ -11,7 +11,7 @@ vi.mock("@/services/environment", () => ({
},
}));
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { GET, POST } from "../route";
const BACKEND = "https://backend.test";
@@ -283,3 +283,39 @@ describe("proxy route — handler pass-through", () => {
);
});
});
+
+describe("proxy route — response-start timeout", () => {
+ beforeEach(() => {
+ vi.mocked(getServerAuthToken).mockResolvedValue("test-token");
+ vi.stubGlobal("fetch", vi.fn());
+ vi.useFakeTimers();
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+ });
+
+ it("returns 504 when the backend never starts responding to a bodyless request", async () => {
+ vi.mocked(fetch).mockImplementation(
+ (_url, init) =>
+ new Promise((_resolve, reject) => {
+ init!.signal!.addEventListener("abort", () =>
+ reject(init!.signal!.reason),
+ );
+ }),
+ );
+
+ const req = new NextRequest("https://app.test/api/proxy/api/v1/slow");
+ const resPromise = GET(req, makeParams(["api", "v1", "slow"]));
+
+ await vi.advanceTimersByTimeAsync(31_000);
+
+ const res = await resPromise;
+ expect(res.status).toBe(504);
+ expect(await res.json()).toMatchObject({
+ error: "Proxy request timed out",
+ });
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.helpers.ts b/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.helpers.ts
index 8e46f12225..93d8c4e7ce 100644
--- a/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.helpers.ts
+++ b/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.helpers.ts
@@ -144,3 +144,46 @@ export function getWorkspaceDownloadErrorMessage(body: unknown): string | null {
return null;
}
+
+// A backend that stays silent this long AFTER receiving the full request is
+// stalled — legitimate work answers with headers well within this, while
+// legitimately slow transfers (big uploads) spend their time in the upload
+// phase, which this timeout deliberately excludes.
+export const RESPONSE_START_TIMEOUT_MS = 30_000;
+
+export function watchResponseStart(requestBody: ReadableStream | null) {
+ const abort = new AbortController();
+ let timer: ReturnType<typeof setTimeout> | undefined;
+
+ function arm() {
+ timer = setTimeout(
+ () =>
+ abort.abort(
+ new DOMException(
+ "Backend sent no response within " +
+ `${RESPONSE_START_TIMEOUT_MS}ms of receiving the request`,
+ "TimeoutError",
+ ),
+ ),
+ RESPONSE_START_TIMEOUT_MS,
+ );
+ }
+
+ // With a body, the clock starts only once the upload has been fully read
+ // (TransformStream flush); without one there is no upload phase, so it
+ // starts immediately.
+ let body: ReadableStream | undefined;
+ if (requestBody) {
+ body = requestBody.pipeThrough(new TransformStream({ flush: arm }));
+ } else {
+ arm();
+ }
+
+ return {
+ body,
+ signal: abort.signal,
+ // Call when the backend starts responding (or errors): from that point
+ // only the overall fetch ceiling applies.
+ clear: () => clearTimeout(timer),
+ };
+}
diff --git a/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.ts b/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.ts
index 68f022cd25..01fb967e97 100644
--- a/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.ts
+++ b/autogpt_platform/frontend/src/app/api/proxy/[...path]/route.ts
@@ -2,7 +2,7 @@ import {
API_KEY_HEADER_NAME,
IMPERSONATION_HEADER_NAME,
} from "@/lib/constants";
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { environment } from "@/services/environment";
import { NextRequest, NextResponse } from "next/server";
@@ -10,12 +10,29 @@ import {
fetchWorkspaceDownloadWithRetry,
getWorkspaceDownloadErrorMessage,
isWorkspaceDownloadRequest,
+ watchResponseStart,
} from "./route.helpers";
// 5 minutes for large uploads. Most calls finish in well under a second.
export const maxDuration = 300;
export const dynamic = "force-dynamic";
+// Hard ceiling on the backend hop so a stalled connection becomes a definite
+// 504 instead of an eternal spinner. Sized just under `maxDuration` so it never
+// interrupts a legitimate large upload/download that fits the function budget —
+// it only converts a true stall (which would otherwise hit Vercel's opaque
+// function timeout) into a clean error response.
+const BACKEND_FETCH_TIMEOUT_MS = 290_000;
+
+function isTimeoutError(error: unknown): boolean {
+ return (
+ typeof error === "object" &&
+ error !== null &&
+ "name" in error &&
+ (error as { name: unknown }).name === "TimeoutError"
+ );
+}
+
const FORWARDED_REQUEST_HEADERS: ReadonlyArray<string> = [
"content-type",
"content-length",
@@ -197,15 +214,30 @@ async function handler(
const headers = buildForwardHeaders(req, token);
const hasBody = !METHODS_WITHOUT_BODY.has(method);
- const backendResponse = await fetch(backendUrl, {
- method,
- headers,
- body: hasBody ? req.body : undefined,
- // `duplex: "half"` is required by Node's fetch when sending a
- // ReadableStream body. Cast because TS lib types haven't caught up.
- ...(hasBody ? ({ duplex: "half" } as RequestInit) : {}),
- redirect: "manual",
- });
+ // Two-phase timeout: the overall ceiling covers the whole hop, while the
+ // much tighter response-start watch arms only once the request body has
+ // been fully uploaded — a multi-minute upload is legitimate, a backend
+ // that stays silent after receiving everything is stalled.
+ const responseStart = watchResponseStart(hasBody ? req.body : null);
+
+ let backendResponse: Response;
+ try {
+ backendResponse = await fetch(backendUrl, {
+ method,
+ headers,
+ body: responseStart.body,
+ // `duplex: "half"` is required by Node's fetch when sending a
+ // ReadableStream body. Cast because TS lib types haven't caught up.
+ ...(responseStart.body ? ({ duplex: "half" } as RequestInit) : {}),
+ redirect: "manual",
+ signal: AbortSignal.any([
+ AbortSignal.timeout(BACKEND_FETCH_TIMEOUT_MS),
+ responseStart.signal,
+ ]),
+ });
+ } finally {
+ responseStart.clear();
+ }
return new NextResponse(backendResponse.body, {
status: backendResponse.status,
@@ -213,13 +245,14 @@ async function handler(
headers: filterResponseHeaders(backendResponse.headers),
});
} catch (error) {
+ const timedOut = isTimeoutError(error);
console.error(`Proxy error for ${method} /${path.join("/")}:`, error);
return NextResponse.json(
{
- error: "Proxy request failed",
+ error: timedOut ? "Proxy request timed out" : "Proxy request failed",
detail: error instanceof Error ? error.message : "Unknown error",
},
- { status: 502 },
+ { status: timedOut ? 504 : 502 },
);
}
}
diff --git a/autogpt_platform/frontend/src/app/api/transcribe/__tests__/route.test.ts b/autogpt_platform/frontend/src/app/api/transcribe/__tests__/route.test.ts
index e553c735c7..938f5987b6 100644
--- a/autogpt_platform/frontend/src/app/api/transcribe/__tests__/route.test.ts
+++ b/autogpt_platform/frontend/src/app/api/transcribe/__tests__/route.test.ts
@@ -1,11 +1,11 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { NextRequest } from "next/server";
-vi.mock("@/lib/autogpt-server-api/helpers", () => ({
+vi.mock("@/lib/auth/server/getServerAuthToken", () => ({
getServerAuthToken: vi.fn(),
}));
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { POST } from "../route";
function makeAudioRequest(type = "audio/webm"): NextRequest {
diff --git a/autogpt_platform/frontend/src/app/api/transcribe/route.ts b/autogpt_platform/frontend/src/app/api/transcribe/route.ts
index 5604198485..7ed62aa54e 100644
--- a/autogpt_platform/frontend/src/app/api/transcribe/route.ts
+++ b/autogpt_platform/frontend/src/app/api/transcribe/route.ts
@@ -1,4 +1,4 @@
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { NextRequest, NextResponse } from "next/server";
const DEFAULT_TRANSCRIPTION_API_BASE_URL = "https://api.openai.com/v1";
diff --git a/autogpt_platform/frontend/src/app/api/workspace/files/upload/route.ts b/autogpt_platform/frontend/src/app/api/workspace/files/upload/route.ts
index b90d0a6466..3fa877a6fe 100644
--- a/autogpt_platform/frontend/src/app/api/workspace/files/upload/route.ts
+++ b/autogpt_platform/frontend/src/app/api/workspace/files/upload/route.ts
@@ -1,5 +1,5 @@
import { environment } from "@/services/environment";
-import { getServerAuthToken } from "@/lib/autogpt-server-api/helpers";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx
index e830e80861..21da3ae150 100644
--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/PublishAgentModal.tsx
@@ -10,8 +10,8 @@ import { Dialog } from "@/components/molecules/Dialog/Dialog";
import { Skeleton } from "@/components/__legacy__/ui/skeleton";
import { Button } from "@/components/atoms/Button/Button";
import { Props, usePublishAgentModal } from "./usePublishAgentModal";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { SubmissionStatus } from "@/app/api/__generated__/models/submissionStatus";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
import { getApprovedMarketplaceUrl } from "@/lib/utils";
import {
PublishAuthPrompt,
@@ -50,7 +50,7 @@ export function PublishAgentModal({
preSelectedAgentVersion,
});
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
const shouldReduceMotion = useReducedMotion();
const stepOrder = React.useMemo(
diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx
index 9369d1364c..2ba7d87be8 100644
--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/AgentSelectStep.test.tsx
@@ -4,8 +4,8 @@ import { render } from "@/tests/integrations/test-utils";
import { server } from "@/mocks/mock-server";
import { http, HttpResponse } from "msw";
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isLoggedIn: true }),
}));
import { AgentSelectStep } from "../AgentSelectStep";
diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/useAgentSelectStep.test.tsx b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/useAgentSelectStep.test.tsx
index ee32a9340d..4e4e6b37a4 100644
--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/useAgentSelectStep.test.tsx
+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/__tests__/useAgentSelectStep.test.tsx
@@ -4,8 +4,8 @@ import { ReactNode } from "react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { MyAgentsSortBy } from "@/app/api/__generated__/models/myAgentsSortBy";
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({ isLoggedIn: true }),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({ isLoggedIn: true }),
}));
const getMyAgentsMock = vi.fn();
diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts
index 70ec31aef2..d4489e20f1 100644
--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts
+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/components/AgentSelectStep/useAgentSelectStep.ts
@@ -4,7 +4,7 @@ import { useGetV2GetMyAgents } from "@/app/api/__generated__/endpoints/store/sto
import { okData } from "@/app/api/helpers";
import { MyAgentsSortBy } from "@/app/api/__generated__/models/myAgentsSortBy";
import { useDebouncedValue } from "@/hooks/useDebouncedValue";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
export interface Agent {
name: string;
@@ -57,7 +57,7 @@ export function useAgentSelectStep({
const debouncedSearch = useDebouncedValue(searchInput.trim(), 300);
const isDebouncingSearch = searchInput.trim() !== debouncedSearch;
const queryPage = searchResetPending ? 1 : page;
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
React.useEffect(() => {
setPage(1);
diff --git a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts
index 9345903626..5dadfbc603 100644
--- a/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts
+++ b/autogpt_platform/frontend/src/components/contextual/PublishAgentModal/usePublishAgentModal.ts
@@ -13,7 +13,7 @@ import { okData } from "@/app/api/helpers";
import type { MyUnpublishedAgent } from "@/app/api/__generated__/models/myUnpublishedAgent";
import type { ProfileDetails } from "@/app/api/__generated__/models/profileDetails";
import { useQueryClient } from "@tanstack/react-query";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
const defaultTargetState: PublishState = {
isOpen: false,
@@ -72,7 +72,7 @@ export function usePublishAgentModal({
const router = useRouter();
const queryClient = useQueryClient();
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
// Fetch agent data for pre-populating form when agent is pre-selected
const { data: myAgents } = useGetV2GetMyAgents(undefined, {
diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx
index 270c8181fb..291a2bb51a 100644
--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx
+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/SidebarUserActions.tsx
@@ -17,10 +17,10 @@ import {
TooltipTrigger as SidebarTooltipTrigger,
} from "@/components/ui/tooltip";
import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
export function SidebarUserActions() {
- const { user, isLoggedIn, isUserLoading } = useSupabase();
+ const { user, isLoggedIn, isUserLoading } = useAuth();
const { state } = useSidebar();
const isCollapsed = state === "collapsed";
const logoutInProgress = isLogoutInProgress();
diff --git a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/__tests__/SidebarUserActions.test.tsx b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/__tests__/SidebarUserActions.test.tsx
index 4990f9fd67..664d2e1960 100644
--- a/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/__tests__/SidebarUserActions.test.tsx
+++ b/autogpt_platform/frontend/src/components/layout/AppSidebar/components/SidebarUserActions/__tests__/SidebarUserActions.test.tsx
@@ -6,9 +6,9 @@ import { server } from "@/mocks/mock-server";
import { SidebarUserActions } from "../SidebarUserActions";
-const mockUseSupabase = vi.fn();
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => mockUseSupabase(),
+const mockUseAuth = vi.fn();
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => mockUseAuth(),
}));
vi.mock("@/components/ui/sidebar", async (importOriginal) => {
@@ -47,7 +47,7 @@ afterEach(() => {
describe("SidebarUserActions", () => {
it("renders nothing when the viewer is logged out", () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: null,
isLoggedIn: false,
isUserLoading: false,
@@ -57,7 +57,7 @@ describe("SidebarUserActions", () => {
});
it("renders the user actions row for a logged-in user", async () => {
- mockUseSupabase.mockReturnValue({
+ mockUseAuth.mockReturnValue({
user: { id: "u1", email: "[email protected]", role: "user" },
isLoggedIn: true,
isUserLoading: false,
diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
index d02b8456ca..e882865eae 100644
--- a/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
+++ b/autogpt_platform/frontend/src/components/layout/Navbar/Navbar.tsx
@@ -8,7 +8,7 @@ import { PreviewBanner } from "@/components/layout/Navbar/components/PreviewBann
import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
import { NAVBAR_HEIGHT_PX } from "@/lib/constants";
import { useBreakpoint } from "@/lib/hooks/useBreakpoint";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { environment } from "@/services/environment";
import { AccountMenu } from "./components/AccountMenu/AccountMenu";
import { FeedbackButton } from "./components/FeedbackButton";
@@ -34,7 +34,7 @@ function pickMobileNavIcon(href: string): IconType {
}
export function Navbar() {
- const { user, isLoggedIn, isUserLoading } = useSupabase();
+ const { user, isLoggedIn, isUserLoading } = useAuth();
const breakpoint = useBreakpoint();
const isSmallScreen = breakpoint === "sm" || breakpoint === "base";
const dynamicMenuItems = getAccountMenuItems(user?.role);
diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts b/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts
index ff91019f3c..e502d635cf 100644
--- a/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts
+++ b/autogpt_platform/frontend/src/components/layout/Navbar/useNavbar.ts
@@ -1,9 +1,9 @@
import { useGetV2GetUserProfile } from "@/app/api/__generated__/endpoints/store/store";
import { isLogoutInProgress } from "@/lib/autogpt-server-api/helpers";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
export function useNavbar() {
- const { isLoggedIn, isUserLoading } = useSupabase();
+ const { isLoggedIn, isUserLoading } = useAuth();
const logoutInProgress = isLogoutInProgress();
const {
diff --git a/autogpt_platform/frontend/src/components/molecules/TallyPoup/useTallyPopup.ts b/autogpt_platform/frontend/src/components/molecules/TallyPoup/useTallyPopup.ts
index b0e9626035..c4de42130e 100644
--- a/autogpt_platform/frontend/src/components/molecules/TallyPoup/useTallyPopup.ts
+++ b/autogpt_platform/frontend/src/components/molecules/TallyPoup/useTallyPopup.ts
@@ -1,7 +1,7 @@
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import * as Sentry from "@sentry/nextjs";
-import { getCurrentUser } from "@/lib/supabase/actions";
+import { getCurrentUser } from "@/lib/auth/actions";
export function useTallyPopup() {
const [isFormVisible, setIsFormVisible] = useState(false);
diff --git a/autogpt_platform/frontend/src/components/monitor/SentryUserTracker.tsx b/autogpt_platform/frontend/src/components/monitor/SentryUserTracker.tsx
index 78159f73df..c7bc61e96c 100644
--- a/autogpt_platform/frontend/src/components/monitor/SentryUserTracker.tsx
+++ b/autogpt_platform/frontend/src/components/monitor/SentryUserTracker.tsx
@@ -2,7 +2,7 @@
import { useEffect } from "react";
import * as Sentry from "@sentry/nextjs";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
/**
* SentryUserTracker component sets user context in Sentry for error tracking.
@@ -15,7 +15,7 @@ import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
* - Updates context when user data changes
*/
export function SentryUserTracker() {
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
useEffect(() => {
if (user) {
diff --git a/autogpt_platform/frontend/src/hooks/useOnboardingTimezoneDetection.ts b/autogpt_platform/frontend/src/hooks/useOnboardingTimezoneDetection.ts
index f1f22138b1..9e248c1559 100644
--- a/autogpt_platform/frontend/src/hooks/useOnboardingTimezoneDetection.ts
+++ b/autogpt_platform/frontend/src/hooks/useOnboardingTimezoneDetection.ts
@@ -1,6 +1,6 @@
import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { usePostV1UpdateUserTimezone } from "@/app/api/__generated__/endpoints/auth/auth";
/**
@@ -12,7 +12,7 @@ export const useOnboardingTimezoneDetection = () => {
const updateTimezone = usePostV1UpdateUserTimezone();
const hasAttemptedDetection = useRef(false);
const pathname = usePathname();
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
// Check if we're on onboarding route (computed outside useEffect to avoid re-computing)
const isOnOnboardingRoute = pathname.startsWith("/onboarding");
diff --git a/autogpt_platform/frontend/src/lib/__tests__/direct-upload.test.ts b/autogpt_platform/frontend/src/lib/__tests__/direct-upload.test.ts
index 1d92358acc..14a147d860 100644
--- a/autogpt_platform/frontend/src/lib/__tests__/direct-upload.test.ts
+++ b/autogpt_platform/frontend/src/lib/__tests__/direct-upload.test.ts
@@ -10,7 +10,7 @@ import {
} from "../direct-upload";
const getTokenMock = vi.hoisted(() => vi.fn());
-vi.mock("@/lib/supabase/actions", () => ({
+vi.mock("@/lib/auth/actions", () => ({
getWebSocketToken: getTokenMock,
}));
diff --git a/autogpt_platform/frontend/src/lib/auth-redirect.test.ts b/autogpt_platform/frontend/src/lib/auth-redirect.test.ts
index 8e645384d9..788453cfce 100644
--- a/autogpt_platform/frontend/src/lib/auth-redirect.test.ts
+++ b/autogpt_platform/frontend/src/lib/auth-redirect.test.ts
@@ -31,4 +31,59 @@ describe("sanitizeAuthNext", () => {
expect(sanitizeAuthNext("/copilot#section")).toBe("/copilot#section");
expect(sanitizeAuthNext("/")).toBe("/");
});
+
+ // Everything below resolves off-origin through the WHATWG URL parser, which
+ // is what window.location.href and NextResponse.redirect both use. Each case
+ // passes a naive startsWith("/") && !startsWith("//") check, so they are the
+ // family of bypasses that guard cannot see.
+ describe("off-origin escapes that survive a prefix-only check", () => {
+ const escapes = [
+ ["backslash host", "/\\evil.com"],
+ ["backslash host with path", "/\\evil.com/path"],
+ ["double backslash", "\\\\evil.com"],
+ ["mixed slash/backslash", "/\\/evil.com"],
+ ["backslash after slash", "/\\\\evil.com"],
+ ["tab before host", "/\t/evil.com"],
+ ["newline before host", "/\n/evil.com"],
+ ["carriage return before host", "/\r/evil.com"],
+ ["backslash anywhere in path", "/foo\\bar"],
+ ] as const;
+
+ test.each(escapes)("rejects %s", (_label, value) => {
+ expect(sanitizeAuthNext(value)).toBeNull();
+ });
+
+ test("the rejected values really do resolve off-origin", () => {
+ // Guards the premise: if a future URL-parser change made these safe, this
+ // assertion fails and tells us the guard can be relaxed, rather than the
+ // tests silently over-protecting.
+ const origin = "https://app.example";
+ const offOrigin = escapes
+ .map(([, value]) => value)
+ .filter((value) => {
+ try {
+ return new URL(value, origin).origin !== origin;
+ } catch {
+ return false;
+ }
+ });
+ expect(offOrigin.length).toBeGreaterThan(0);
+ });
+ });
+
+ test("percent-encoded backslash is covered (searchParams decodes before we see it)", () => {
+ const decoded = new URLSearchParams("next=%2F%5Cevil.com").get("next");
+ expect(decoded).toBe("/\\evil.com");
+ expect(sanitizeAuthNext(decoded)).toBeNull();
+ });
+
+ test("keeps accepting ordinary paths that merely contain unusual characters", () => {
+ expect(sanitizeAuthNext("/build?flowID=a-b_c.d~e")).toBe(
+ "/build?flowID=a-b_c.d~e",
+ );
+ expect(sanitizeAuthNext("/search?q=a%20b&x=1")).toBe("/search?q=a%20b&x=1");
+ expect(sanitizeAuthNext("/path/with-dash/and_underscore")).toBe(
+ "/path/with-dash/and_underscore",
+ );
+ });
});
diff --git a/autogpt_platform/frontend/src/lib/auth-redirect.ts b/autogpt_platform/frontend/src/lib/auth-redirect.ts
index d61ffc74b7..94c398689b 100644
--- a/autogpt_platform/frontend/src/lib/auth-redirect.ts
+++ b/autogpt_platform/frontend/src/lib/auth-redirect.ts
@@ -6,6 +6,13 @@
* absolute URLs and protocol-relative paths (`//host`) so a crafted
* `/login?next=https://phishing.site` cannot redirect users off-site.
*
+ * Backslashes are rejected outright: the WHATWG URL parser treats `\` as `/`
+ * for http(s), so `new URL("/\\evil.com", origin)` resolves to
+ * `https://evil.com/` — a prefix check alone lets that through. Callers hand
+ * the result to `window.location.href` / `NextResponse.redirect`, which use
+ * that same parser. Note the value arrives already percent-decoded (via
+ * `searchParams.get`), so `%5C` is covered by the same check.
+ *
* Returns `null` when the value is missing, empty, or unsafe — callers should
* fall back to their default destination in that case.
*/
@@ -15,5 +22,10 @@ export function sanitizeAuthNext(
if (!rawNext) return null;
if (!rawNext.startsWith("/")) return null;
if (rawNext.startsWith("//")) return null;
+ if (rawNext.includes("\\")) return null;
+ // The URL parser strips tab/CR/LF *before* parsing, so a tab-bearing value
+ // could slip past the checks above and then resolve as "//evil.com".
+ // eslint-disable-next-line no-control-regex
+ if (/[\u0000-\u001F\u007F]/.test(rawNext)) return null;
return rawNext;
}
diff --git a/autogpt_platform/frontend/src/lib/supabase/SESSION_VALIDATION.md b/autogpt_platform/frontend/src/lib/auth/SESSION_VALIDATION.md
similarity index 85%
rename from autogpt_platform/frontend/src/lib/supabase/SESSION_VALIDATION.md
rename to autogpt_platform/frontend/src/lib/auth/SESSION_VALIDATION.md
index 482ceb27fc..a87e7bcd9c 100644
--- a/autogpt_platform/frontend/src/lib/supabase/SESSION_VALIDATION.md
+++ b/autogpt_platform/frontend/src/lib/auth/SESSION_VALIDATION.md
@@ -1,6 +1,6 @@
# Server-Side Session Validation with httpOnly Cookies
-This implementation ensures that Supabase session validation is always performed on the server side using httpOnly cookies for improved security.
+This implementation ensures that session validation is always performed on the server side using httpOnly cookies for improved security. Sessions are managed by Better Auth.
## Key Features
@@ -15,7 +15,7 @@ This implementation ensures that Supabase session validation is always performed
All API requests made through `BackendAPI` are automatically proxied through server actions that:
-1. Retrieve the JWT token from server-side httpOnly cookies
+1. Retrieve the JWT token for the current Better Auth session from server-side httpOnly cookies
2. Make the authenticated request to the backend API
3. Return the response to the client
@@ -25,15 +25,15 @@ This includes both regular API calls and file uploads, all handled transparently
### Client Components
-No changes needed! The existing `useSupabase` hook and `useBackendAPI` continue to work:
+No changes needed! The existing `useAuth` hook and `useBackendAPI` continue to work:
```tsx
"use client";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
function MyComponent() {
- const { user, isLoggedIn, isUserLoading, logOut } = useSupabase();
+ const { user, isLoggedIn, isUserLoading, logOut } = useAuth();
const api = useBackendAPI();
if (isUserLoading) return <div>Loading...</div>;
@@ -76,7 +76,7 @@ function MyComponent() {
No changes needed! Server components continue to work as before:
```tsx
-import { validateSession, getCurrentUser } from "@/lib/supabase/actions";
+import { validateSession, getCurrentUser } from "@/lib/auth/actions";
import { redirect } from "next/navigation";
async function MyServerComponent() {
@@ -96,7 +96,7 @@ No changes needed! Server actions continue to work as before:
```tsx
"use server";
-import { validateSession } from "@/lib/supabase/actions";
+import { validateSession } from "@/lib/auth/actions";
import BackendAPI from "@/lib/autogpt-server-api";
import { redirect } from "next/navigation";
@@ -138,8 +138,9 @@ const mediaUrl = await api.uploadStoreSubmissionMedia(file);
- `validateSession(currentPath)` - Validates the current session and returns user data
- `getCurrentUser()` - Gets the current user without path validation
+- `getWebSocketToken()` - Mints a backend JWT for WebSocket authentication
- `serverLogout()` - Logs out the user server-side
-- `refreshSession()` - Refreshes the current session
+- `refreshSession()` - Re-reads (and slides) the current cookie session
## Internal Architecture
@@ -149,7 +150,7 @@ All API requests (including file uploads) follow this flow:
1. **Any API call**: `api.listGraphs()` or `api.uploadStoreSubmissionMedia(file)`
2. **Proxy server action**: `proxyApiRequest()` or `proxyFileUpload()` handles the request
-3. **Server authentication**: Gets JWT from httpOnly cookies
+3. **Server authentication**: Mints a backend JWT from the Better Auth session cookie (`better-auth.session_token`)
4. **Backend request**: Makes authenticated request to backend API
5. **Response**: Returns data to the calling code
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/actions.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/actions.test.ts
new file mode 100644
index 0000000000..5ed0e0b50d
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/actions.test.ts
@@ -0,0 +1,298 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const getServerSessionMock = vi.fn();
+const getServerAuthTokenMock = vi.fn();
+const signOutMock = vi.fn();
+const { cookieJar, setCalls } = vi.hoisted(() => ({
+ cookieJar: new Map<string, string>(),
+ setCalls: [] as Array<{
+ name: string;
+ value: string;
+ options?: { maxAge?: number; secure?: boolean; path?: string };
+ }>,
+}));
+
+vi.mock("../auth", () => ({
+ auth: {
+ api: {
+ signOut: (...args: unknown[]) => signOutMock(...args),
+ },
+ },
+}));
+
+vi.mock("../server/getServerSession", () => ({
+ getServerSession: () => getServerSessionMock(),
+}));
+
+vi.mock("@/lib/auth/server/getServerAuthToken", () => ({
+ getServerAuthToken: () => getServerAuthTokenMock(),
+}));
+
+vi.mock("next/headers", () => ({
+ headers: vi.fn(async () => new Headers()),
+ cookies: async () => ({
+ getAll: () =>
+ [...cookieJar.keys()].map((name) => ({
+ name,
+ value: cookieJar.get(name) ?? "",
+ })),
+ set: (
+ name: string,
+ value: string,
+ options?: { maxAge?: number; secure?: boolean; path?: string },
+ ) => {
+ setCalls.push({ name, value, options });
+ if (options?.maxAge === 0) cookieJar.delete(name);
+ else cookieJar.set(name, value);
+ },
+ delete: (name: string) => {
+ cookieJar.delete(name);
+ },
+ }),
+}));
+
+const captureExceptionMock = vi.hoisted(() => vi.fn());
+
+vi.mock("@sentry/nextjs", () => ({
+ withServerActionInstrumentation: (
+ _name: string,
+ _options: object,
+ fn: () => unknown,
+ ) => fn(),
+ captureException: captureExceptionMock,
+}));
+
+import {
+ getCurrentUser,
+ getWebSocketToken,
+ refreshSession,
+ serverLogout,
+ validateSession,
+} from "../actions";
+
+const sessionUser = {
+ id: "user-1",
+ email: "[email protected]",
+ name: "Test User",
+ role: "user",
+ createdAt: new Date("2026-01-02T03:04:05.000Z"),
+};
+
+beforeEach(() => {
+ getServerSessionMock.mockReset();
+ getServerAuthTokenMock.mockReset();
+ signOutMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("validateSession", () => {
+ it("returns the mapped user and marks the session valid", async () => {
+ getServerSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const result = await validateSession("/copilot");
+
+ expect(result.isValid).toBe(true);
+ expect(result.redirectPath).toBeUndefined();
+ expect(result.user).toEqual({
+ id: "user-1",
+ email: "[email protected]",
+ role: "authenticated",
+ created_at: "2026-01-02T03:04:05.000Z",
+ user_metadata: { name: "Test User", email: "[email protected]" },
+ });
+ });
+
+ it("redirects protected paths to login when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const result = await validateSession("/copilot");
+
+ expect(result.isValid).toBe(false);
+ expect(result.user).toBeNull();
+ expect(result.redirectPath).toBe(
+ `/login?next=${encodeURIComponent("/copilot")}`,
+ );
+ });
+
+ it("omits the redirect for public paths when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const result = await validateSession("/marketplace");
+
+ expect(result.isValid).toBe(false);
+ expect(result.redirectPath).toBeUndefined();
+ });
+
+ it("falls back to a login redirect when the session lookup throws", async () => {
+ getServerSessionMock.mockRejectedValue(new Error("db unavailable"));
+
+ const result = await validateSession("/library");
+
+ expect(result.isValid).toBe(false);
+ expect(result.redirectPath).toBe(
+ `/login?next=${encodeURIComponent("/library")}`,
+ );
+ });
+});
+
+describe("getCurrentUser", () => {
+ it("maps the session user", async () => {
+ getServerSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const result = await getCurrentUser();
+
+ expect(result.error).toBeUndefined();
+ expect(result.user?.id).toBe("user-1");
+ expect(result.user?.user_metadata).toEqual({
+ name: "Test User",
+ email: "[email protected]",
+ });
+ });
+
+ it("returns a null user without an error when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const result = await getCurrentUser();
+
+ expect(result).toEqual({ user: null });
+ });
+
+ it("surfaces the error message when the session lookup throws", async () => {
+ getServerSessionMock.mockRejectedValue(new Error("session store down"));
+
+ const result = await getCurrentUser();
+
+ expect(result.user).toBeNull();
+ expect(result.error).toBe("session store down");
+ });
+});
+
+describe("getWebSocketToken", () => {
+ it("returns the token from the server auth helper", async () => {
+ getServerAuthTokenMock.mockResolvedValue("ws-token-123");
+
+ const result = await getWebSocketToken();
+
+ expect(result).toEqual({ token: "ws-token-123" });
+ });
+
+ it("returns a null token and the error message when token retrieval throws", async () => {
+ getServerAuthTokenMock.mockRejectedValue(new Error("jwks unreachable"));
+
+ const result = await getWebSocketToken();
+
+ expect(result.token).toBeNull();
+ expect(result.error).toBe("jwks unreachable");
+ });
+});
+
+describe("serverLogout", () => {
+ beforeEach(() => {
+ cookieJar.clear();
+ setCalls.length = 0;
+ });
+
+ it("signs out via Better Auth and clears the auth cookies", async () => {
+ signOutMock.mockResolvedValue({ success: true });
+ cookieJar.set("better-auth.session_token", "tok");
+ cookieJar.set("better-auth.session_data", "data");
+ cookieJar.set("sb-localhost-auth-token", "legacy");
+ cookieJar.set("theme", "dark");
+
+ const result = await serverLogout();
+
+ expect(signOutMock).toHaveBeenCalledWith({
+ headers: expect.any(Headers),
+ });
+ expect(result).toEqual({ success: true });
+ // All auth cookies (Better Auth + leftover Supabase) are expired;
+ // unrelated cookies survive.
+ expect(cookieJar.has("better-auth.session_token")).toBe(false);
+ expect(cookieJar.has("better-auth.session_data")).toBe(false);
+ expect(cookieJar.has("sb-localhost-auth-token")).toBe(false);
+ expect(cookieJar.has("theme")).toBe(true);
+ });
+
+ it("still clears the cookies and reports success when sign-out throws", async () => {
+ // A failed server-side revocation must not leave a half-dead session
+ // whose surviving cookie bounces the user back into the app.
+ const revocationError = new Error("session revocation failed");
+ signOutMock.mockRejectedValue(revocationError);
+ cookieJar.set("better-auth.session_token", "tok");
+
+ const result = await serverLogout();
+
+ expect(result).toEqual({ success: true });
+ expect(cookieJar.has("better-auth.session_token")).toBe(false);
+ // The user is logged out locally, but the session row may still be live —
+ // that's only actionable if it's reported, not just console.error'd.
+ expect(captureExceptionMock).toHaveBeenCalledWith(revocationError);
+ });
+
+ it("expires __Secure- cookies WITH the Secure attribute so HTTPS logout isn't rejected", async () => {
+ // Regression: a bare cookies().delete() emits Set-Cookie without `Secure`,
+ // which the browser rejects for `__Secure-`-prefixed cookies over HTTPS —
+ // the session survives and /login bounces the user straight back in. The
+ // deletion must carry Secure + maxAge 0 for the prefixed cookies.
+ signOutMock.mockResolvedValue({ success: true });
+ cookieJar.set("__Secure-better-auth.session_token", "tok");
+ cookieJar.set("__Secure-better-auth.session_data", "data");
+ cookieJar.set("better-auth.session_token", "plain");
+
+ await serverLogout();
+
+ expect(cookieJar.has("__Secure-better-auth.session_token")).toBe(false);
+ expect(cookieJar.has("__Secure-better-auth.session_data")).toBe(false);
+
+ const secureExpiry = setCalls.find(
+ (c) => c.name === "__Secure-better-auth.session_token",
+ );
+ expect(secureExpiry?.options?.maxAge).toBe(0);
+ expect(secureExpiry?.options?.secure).toBe(true);
+
+ // A non-prefixed cookie (local HTTP) is expired without requiring Secure.
+ const plainExpiry = setCalls.find(
+ (c) => c.name === "better-auth.session_token",
+ );
+ expect(plainExpiry?.options?.maxAge).toBe(0);
+ expect(plainExpiry?.options?.secure).toBe(false);
+ });
+});
+
+describe("refreshSession", () => {
+ it("returns the mapped user when the session is still active", async () => {
+ getServerSessionMock.mockResolvedValue({ user: sessionUser });
+
+ const result = await refreshSession();
+
+ expect(result).toEqual({
+ user: {
+ id: "user-1",
+ email: "[email protected]",
+ role: "authenticated",
+ created_at: "2026-01-02T03:04:05.000Z",
+ user_metadata: { name: "Test User", email: "[email protected]" },
+ },
+ });
+ });
+
+ it("returns an error when there is no active session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const result = await refreshSession();
+
+ expect(result).toEqual({ user: null, error: "No active session" });
+ });
+
+ it("returns the error message when the session lookup throws", async () => {
+ getServerSessionMock.mockRejectedValue(new Error("connection reset"));
+
+ const result = await refreshSession();
+
+ expect(result).toEqual({ user: null, error: "connection reset" });
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/auth-config.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/auth-config.test.ts
new file mode 100644
index 0000000000..9de91578f1
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/auth-config.test.ts
@@ -0,0 +1,310 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+vi.mock("pg", () => ({ Pool: vi.fn() }));
+vi.mock("better-auth", () => ({
+ betterAuth: vi.fn((options: unknown) => ({ options })),
+}));
+vi.mock("better-auth/next-js", () => ({
+ nextCookies: vi.fn(() => ({ id: "next-cookies" })),
+}));
+vi.mock("better-auth/plugins", () => ({
+ admin: vi.fn(() => ({ id: "admin" })),
+ jwt: vi.fn((opts: unknown) => ({ id: "jwt", opts })),
+}));
+vi.mock("../supabase-bridge", () => ({
+ supabaseBridge: vi.fn(() => ({ id: "supabase-bridge" })),
+}));
+const sendAuthEmailMock = vi.fn();
+vi.mock("../email", () => ({
+ sendAuthEmail: (...args: unknown[]) => sendAuthEmailMock(...args),
+}));
+
+interface JwtPluginOptions {
+ jwt: {
+ audience: string;
+ expirationTime: string;
+ definePayload: (args: {
+ user: { id: string; email: string; name: string; role?: string };
+ }) => {
+ email: string;
+ role: string;
+ user_metadata: { name: string };
+ };
+ };
+}
+
+interface AuthEmailArgs {
+ user: { email: string };
+ url: string;
+}
+
+interface CapturedAuthOptions {
+ emailAndPassword: {
+ minPasswordLength: number;
+ revokeSessionsOnPasswordReset: boolean;
+ password: {
+ hash: (password: string) => Promise<string>;
+ verify: (args: { hash: string; password: string }) => Promise<boolean>;
+ };
+ sendResetPassword: (args: AuthEmailArgs) => Promise<void>;
+ };
+ emailVerification: {
+ sendVerificationEmail: (args: AuthEmailArgs) => Promise<void>;
+ };
+ user: {
+ changeEmail: {
+ enabled: boolean;
+ updateEmailWithoutVerification: boolean;
+ sendChangeEmailConfirmation: (args: {
+ user: { email: string };
+ newEmail: string;
+ url: string;
+ token: string;
+ }) => Promise<void>;
+ };
+ };
+ advanced: { database: { generateId: () => string } };
+ socialProviders: Record<string, { clientId: string; clientSecret: string }>;
+ plugins: Array<{ id: string; opts?: JwtPluginOptions }>;
+}
+
+async function loadAuthOptions(): Promise<CapturedAuthOptions> {
+ // The global vitest setup mocks @/lib/auth/auth to keep the pg pool out of
+ // page tests; undo that here so we exercise the real config module.
+ vi.doUnmock("../auth");
+ vi.resetModules();
+ const mod = (await import("../auth")) as unknown as {
+ auth: { options: CapturedAuthOptions };
+ };
+ return mod.auth.options;
+}
+
+const PROVIDER_ENV_KEYS = [
+ "AUTH_GOOGLE_CLIENT_ID",
+ "AUTH_GOOGLE_CLIENT_SECRET",
+ "AUTH_GITHUB_CLIENT_ID",
+ "AUTH_GITHUB_CLIENT_SECRET",
+ "AUTH_DISCORD_CLIENT_ID",
+ "AUTH_DISCORD_CLIENT_SECRET",
+];
+
+beforeEach(() => {
+ sendAuthEmailMock.mockReset();
+ for (const key of PROVIDER_ENV_KEYS) {
+ vi.stubEnv(key, "");
+ }
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+});
+
+describe("auth config", () => {
+ it("revokes all sessions on password reset and enforces the 12-char password floor on the raw endpoints", async () => {
+ const options = await loadAuthOptions();
+
+ expect(options.emailAndPassword.revokeSessionsOnPasswordReset).toBe(true);
+ // Must be 12, not GoTrue's old 6: the Better Auth handler mounts
+ // /sign-up/email and /reset-password directly, so this is the real floor
+ // for every set-password path (the signup zod only guards the form).
+ expect(options.emailAndPassword.minPasswordLength).toBe(12);
+ });
+
+ it("hashes passwords with bcrypt and verifies them round-trip", async () => {
+ const options = await loadAuthOptions();
+ const { hash, verify } = options.emailAndPassword.password;
+
+ const hashed = await hash("correct horse battery staple");
+
+ expect(hashed).toMatch(/^\$2[aby]\$10\$/);
+ expect(
+ await verify({ hash: hashed, password: "correct horse battery staple" }),
+ ).toBe(true);
+ expect(await verify({ hash: hashed, password: "wrong password" })).toBe(
+ false,
+ );
+ });
+
+ it("configures the JWT plugin with the Supabase-compatible audience and expiry", async () => {
+ const options = await loadAuthOptions();
+ const jwtPlugin = options.plugins.find((plugin) => plugin.id === "jwt");
+
+ expect(jwtPlugin?.opts?.jwt.audience).toBe("authenticated");
+ expect(jwtPlugin?.opts?.jwt.expirationTime).toBe("1h");
+ });
+
+ it("maps admin users to the admin role and everyone else to authenticated in the JWT payload", async () => {
+ const options = await loadAuthOptions();
+ const jwtPlugin = options.plugins.find((plugin) => plugin.id === "jwt");
+ const definePayload = jwtPlugin?.opts?.jwt.definePayload;
+
+ expect(definePayload).toBeDefined();
+ expect(
+ definePayload?.({
+ user: {
+ id: "u1",
+ email: "[email protected]",
+ name: "Admin",
+ role: "admin",
+ },
+ }),
+ ).toEqual({
+ email: "[email protected]",
+ role: "admin",
+ user_metadata: { name: "Admin" },
+ });
+ expect(
+ definePayload?.({
+ user: {
+ id: "u2",
+ email: "[email protected]",
+ name: "Regular",
+ role: "user",
+ },
+ }),
+ ).toEqual({
+ email: "[email protected]",
+ role: "authenticated",
+ user_metadata: { name: "Regular" },
+ });
+ });
+
+ it("generates UUID-shaped database ids", async () => {
+ const options = await loadAuthOptions();
+
+ const id = options.advanced.database.generateId();
+
+ expect(id).toMatch(
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
+ );
+ });
+
+ it("registers no social providers when no provider env vars are set", async () => {
+ const options = await loadAuthOptions();
+
+ expect(options.socialProviders).toEqual({});
+ });
+
+ it("registers google when its client id and secret are configured", async () => {
+ vi.stubEnv("AUTH_GOOGLE_CLIENT_ID", "google-client-id");
+ vi.stubEnv("AUTH_GOOGLE_CLIENT_SECRET", "google-client-secret");
+
+ const options = await loadAuthOptions();
+
+ expect(options.socialProviders).toEqual({
+ google: {
+ clientId: "google-client-id",
+ clientSecret: "google-client-secret",
+ },
+ });
+ });
+
+ it("sends password reset emails with the reset link", async () => {
+ const options = await loadAuthOptions();
+
+ await options.emailAndPassword.sendResetPassword({
+ user: { email: "[email protected]" },
+ url: "https://platform.example.com/reset?token=abc",
+ });
+
+ expect(sendAuthEmailMock).toHaveBeenCalledWith({
+ type: "reset_password",
+ url: "https://platform.example.com/reset?token=abc",
+ });
+ });
+
+ it("sends verification emails with the verification link", async () => {
+ const options = await loadAuthOptions();
+
+ await options.emailVerification.sendVerificationEmail({
+ user: { email: "[email protected]" },
+ url: "https://platform.example.com/verify?token=xyz",
+ });
+
+ expect(sendAuthEmailMock).toHaveBeenCalledWith({
+ type: "verify_email",
+ url: "https://platform.example.com/verify?token=xyz",
+ });
+ });
+
+ it("registers the supabase bridge and keeps nextCookies last in the plugin chain", async () => {
+ const options = await loadAuthOptions();
+ const pluginIds = options.plugins.map((plugin) => plugin.id);
+
+ expect(pluginIds).toEqual([
+ "admin",
+ "jwt",
+ "supabase-bridge",
+ "next-cookies",
+ ]);
+ });
+});
+
+describe("change email", () => {
+ it("enables email change and routes the approval mail to the current address", async () => {
+ const options = await loadAuthOptions();
+
+ expect(options.user.changeEmail.enabled).toBe(true);
+
+ await options.user.changeEmail.sendChangeEmailConfirmation({
+ user: { email: "[email protected]" },
+ newEmail: "[email protected]",
+ url: "https://app/approve?token=t",
+ token: "t",
+ });
+
+ expect(sendAuthEmailMock).toHaveBeenCalledWith({
+ type: "change_email",
+ url: "https://app/approve?token=t",
+ });
+ });
+
+ it("uses only change-email option names Better Auth actually supports", async () => {
+ // Regression guard: the config previously used `sendChangeEmailVerification`,
+ // which does not exist in Better Auth. Unknown keys are silently ignored, so
+ // the approval mail quietly fell through to the default handler and went to
+ // the NEW address instead of the current one — losing the anti-takeover
+ // protection. Assert the supported names, and that the dead one is gone.
+ const options = await loadAuthOptions();
+ const changeEmail = options.user.changeEmail as unknown as Record<
+ string,
+ unknown
+ >;
+
+ expect(typeof changeEmail.sendChangeEmailConfirmation).toBe("function");
+ expect(changeEmail.sendChangeEmailVerification).toBeUndefined();
+ // Unverified users have no current address worth protecting, so their change
+ // applies immediately rather than being blocked behind a mail they can't get.
+ expect(changeEmail.updateEmailWithoutVerification).toBe(true);
+ });
+});
+
+describe("auth table names", () => {
+ it("overrides every Better Auth default table name", async () => {
+ // The defaults (user, session, ...) case-collide with the platform's
+ // PascalCase tables (`user` vs `User`) and read ambiguously next to them.
+ // These must stay in lockstep with schema.prisma's @@map values and the
+ // backend migrations — a mismatch strands Better Auth on missing tables.
+ const options = (await loadAuthOptions()) as unknown as {
+ user: { modelName?: string };
+ session: { modelName?: string };
+ account: { modelName?: string };
+ verification: { modelName?: string };
+ plugins: Array<{
+ id: string;
+ opts?: { schema?: { jwks?: { modelName?: string } } };
+ }>;
+ };
+
+ expect(options.user.modelName).toBe("UserAuthIdentity");
+ expect(options.session.modelName).toBe("UserAuthSession");
+ expect(options.account.modelName).toBe("UserAuthAccount");
+ expect(options.verification.modelName).toBe("UserAuthVerification");
+
+ const jwtPlugin = options.plugins.find((plugin) => plugin.id === "jwt");
+ expect(jwtPlugin?.opts?.schema?.jwks?.modelName).toBe("UserAuthJwks");
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/email-mirror.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/email-mirror.test.ts
new file mode 100644
index 0000000000..90f12fbc5f
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/email-mirror.test.ts
@@ -0,0 +1,39 @@
+import { afterEach, describe, expect, test, vi } from "vitest";
+import { mirrorVerifiedEmailToPlatformUser } from "../email-mirror";
+
+describe("mirrorVerifiedEmailToPlatformUser", () => {
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ test("writes the verified email to the platform User row, scoped by id and skipping no-ops", async () => {
+ const query = vi.fn().mockResolvedValue({ rowCount: 1 });
+
+ await mirrorVerifiedEmailToPlatformUser(
+ { query },
+ { id: "user-1", email: "[email protected]" },
+ );
+
+ expect(query).toHaveBeenCalledTimes(1);
+ const [sql, params] = query.mock.calls[0];
+ expect(sql).toContain('UPDATE "User"');
+ expect(sql).toContain("WHERE id = $2");
+ // The `email <> $1` guard keeps the mirror idempotent (no redundant writes).
+ expect(sql).toContain("email <> $1");
+ expect(params).toEqual(["[email protected]", "user-1"]);
+ });
+
+ test("swallows DB errors so a mirror failure never blocks the auth flow", async () => {
+ const query = vi.fn().mockRejectedValue(new Error("unique violation"));
+ const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
+
+ await expect(
+ mirrorVerifiedEmailToPlatformUser(
+ { query },
+ { id: "user-1", email: "[email protected]" },
+ ),
+ ).resolves.toBeUndefined();
+
+ expect(errorSpy).toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/email.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/email.test.ts
new file mode 100644
index 0000000000..95bb1138d7
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/email.test.ts
@@ -0,0 +1,103 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+vi.mock("@/services/environment", () => ({
+ environment: {
+ getAGPTServerBaseUrl: () => "https://backend.example.com",
+ },
+}));
+
+const mintServiceTokenMock = vi.fn();
+vi.mock("../service-token", () => ({
+ mintServiceToken: (...args: unknown[]) => mintServiceTokenMock(...args),
+}));
+
+import { sendAuthEmail } from "../email";
+
+const resetUrl = "https://platform.example.com/reset-password?token=abc123";
+const args = {
+ type: "reset_password" as const,
+ url: resetUrl,
+};
+
+const fetchMock = vi.fn();
+
+beforeEach(() => {
+ fetchMock.mockReset();
+ mintServiceTokenMock.mockReset();
+ mintServiceTokenMock.mockResolvedValue("svc-token");
+ vi.stubGlobal("fetch", fetchMock);
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+ vi.unstubAllGlobals();
+ vi.restoreAllMocks();
+});
+
+describe("sendAuthEmail", () => {
+ it("POSTs the link to the backend mailer with a scoped service token", async () => {
+ fetchMock.mockResolvedValue(new Response(null, { status: 204 }));
+
+ await sendAuthEmail(args);
+
+ expect(mintServiceTokenMock).toHaveBeenCalledWith("auth-email:send");
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
+ expect(url).toBe("https://backend.example.com/api/auth/email/send");
+ expect(init.method).toBe("POST");
+ expect((init.headers as Record<string, string>)["Authorization"]).toBe(
+ "Bearer svc-token",
+ );
+ expect(JSON.parse(init.body as string)).toEqual({
+ type: "reset_password",
+ url: resetUrl,
+ });
+ });
+
+ it("throws in production when the backend returns a non-2xx response", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ fetchMock.mockResolvedValue(new Response("mailer down", { status: 503 }));
+
+ // Throwing (instead of silently returning) keeps the reset-password UI
+ // from claiming "Email sent" when nothing was delivered.
+ await expect(sendAuthEmail(args)).rejects.toThrow(
+ "Backend auth-email send failed (503)",
+ );
+ });
+
+ it("throws in production when minting the service token fails", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ mintServiceTokenMock.mockRejectedValue(new Error("no signing key"));
+
+ await expect(sendAuthEmail(args)).rejects.toThrow("no signing key");
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it("logs the auth link instead of throwing when the send fails outside production", async () => {
+ vi.stubEnv("NODE_ENV", "development");
+ fetchMock.mockResolvedValue(new Response("mailer down", { status: 503 }));
+ const infoSpy = vi
+ .spyOn(console, "info")
+ .mockImplementation(() => undefined);
+
+ await sendAuthEmail(args);
+
+ const logged = infoSpy.mock.calls.map((c) => String(c[0]));
+ expect(logged.some((l) => l.includes(resetUrl))).toBe(true);
+ });
+
+ it("does not log the auth link in production", async () => {
+ vi.stubEnv("NODE_ENV", "production");
+ fetchMock.mockResolvedValue(new Response(null, { status: 500 }));
+ const infoSpy = vi
+ .spyOn(console, "info")
+ .mockImplementation(() => undefined);
+
+ await expect(sendAuthEmail(args)).rejects.toThrow();
+
+ const logged = infoSpy.mock.calls.map((c) => String(c[0]));
+ expect(logged.some((l) => l.includes(resetUrl))).toBe(false);
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/helpers.test.ts
new file mode 100644
index 0000000000..a586f18d75
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/helpers.test.ts
@@ -0,0 +1,184 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const storageGet = vi.fn();
+const storageSet = vi.fn();
+const storageClean = vi.fn();
+const isServerSideMock = vi.fn();
+
+vi.mock("@/services/storage/local-storage", () => ({
+ Key: {
+ LOGOUT: "supabase-logout",
+ WEBSOCKET_DISCONNECT_INTENT: "websocket-disconnect-intent",
+ },
+ storage: {
+ get: (...args: unknown[]) => storageGet(...args),
+ set: (...args: unknown[]) => storageSet(...args),
+ clean: (...args: unknown[]) => storageClean(...args),
+ },
+}));
+
+vi.mock("@/services/environment", () => ({
+ environment: {
+ isServerSide: () => isServerSideMock(),
+ },
+}));
+
+import {
+ broadcastLogout,
+ clearWebSocketDisconnectIntent,
+ getRedirectPath,
+ hasWebSocketDisconnectIntent,
+ isAdminPage,
+ isLogoutEvent,
+ isProtectedPage,
+ setupSessionEventListeners,
+ setWebSocketDisconnectIntent,
+} from "../helpers";
+
+beforeEach(() => {
+ storageGet.mockReset();
+ storageSet.mockReset();
+ storageClean.mockReset();
+ isServerSideMock.mockReset().mockReturnValue(false);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("isProtectedPage", () => {
+ it("matches a protected page exactly", () => {
+ expect(isProtectedPage("/copilot")).toBe(true);
+ });
+
+ it("matches nested paths under a protected prefix", () => {
+ expect(isProtectedPage("/library/agents/123")).toBe(true);
+ });
+
+ it("rejects public pages", () => {
+ expect(isProtectedPage("/marketplace")).toBe(false);
+ });
+});
+
+describe("isAdminPage", () => {
+ it("matches the admin section and its sub-pages", () => {
+ expect(isAdminPage("/admin")).toBe(true);
+ expect(isAdminPage("/admin/marketplace")).toBe(true);
+ });
+
+ it("rejects non-admin pages", () => {
+ expect(isAdminPage("/profile")).toBe(false);
+ });
+});
+
+describe("getRedirectPath", () => {
+ it("sends protected paths to login preserving the original path", () => {
+ expect(getRedirectPath("/copilot?tab=chat")).toBe(
+ `/login?next=${encodeURIComponent("/copilot?tab=chat")}`,
+ );
+ });
+
+ it("sends admin paths through the logout redirect even for non-admin roles", () => {
+ // isAdminPage is part of shouldRedirectOnLogout, so admin paths hit the
+ // login redirect before the role check is ever reached.
+ expect(getRedirectPath("/admin", "user")).toBe(
+ `/login?next=${encodeURIComponent("/admin")}`,
+ );
+ });
+
+ it("returns null for public paths", () => {
+ expect(getRedirectPath("/marketplace")).toBeNull();
+ });
+});
+
+describe("broadcastLogout", () => {
+ it("writes a logout timestamp to the logout storage key", () => {
+ broadcastLogout();
+
+ expect(storageSet).toHaveBeenCalledWith(
+ "supabase-logout",
+ expect.stringMatching(/^\d+$/),
+ );
+ });
+});
+
+describe("isLogoutEvent", () => {
+ it("recognizes storage events for the logout key", () => {
+ const event = new StorageEvent("storage", { key: "supabase-logout" });
+
+ expect(isLogoutEvent(event)).toBe(true);
+ });
+
+ it("ignores storage events for other keys", () => {
+ const event = new StorageEvent("storage", { key: "theme" });
+
+ expect(isLogoutEvent(event)).toBe(false);
+ });
+});
+
+describe("webSocket disconnect intent", () => {
+ it("stores the disconnect intent flag", () => {
+ setWebSocketDisconnectIntent();
+
+ expect(storageSet).toHaveBeenCalledWith(
+ "websocket-disconnect-intent",
+ "true",
+ );
+ });
+
+ it("clears the disconnect intent flag", () => {
+ clearWebSocketDisconnectIntent();
+
+ expect(storageClean).toHaveBeenCalledWith("websocket-disconnect-intent");
+ });
+
+ it("reports intent only when the stored flag is true", () => {
+ storageGet.mockReturnValue("true");
+ expect(hasWebSocketDisconnectIntent()).toBe(true);
+
+ storageGet.mockReturnValue(undefined);
+ expect(hasWebSocketDisconnectIntent()).toBe(false);
+ });
+});
+
+describe("setupSessionEventListeners", () => {
+ it("registers visibility and storage listeners and removes them on cleanup", () => {
+ const documentAdd = vi.spyOn(document, "addEventListener");
+ const documentRemove = vi.spyOn(document, "removeEventListener");
+ const windowAdd = vi.spyOn(window, "addEventListener");
+ const windowRemove = vi.spyOn(window, "removeEventListener");
+ const onVisibilityChange = vi.fn();
+ const onStorageChange = vi.fn();
+
+ const listeners = setupSessionEventListeners(
+ onVisibilityChange,
+ onStorageChange,
+ );
+
+ expect(documentAdd).toHaveBeenCalledWith(
+ "visibilitychange",
+ onVisibilityChange,
+ );
+ expect(windowAdd).toHaveBeenCalledWith("storage", onStorageChange);
+
+ listeners.cleanup();
+
+ expect(documentRemove).toHaveBeenCalledWith(
+ "visibilitychange",
+ onVisibilityChange,
+ );
+ expect(windowRemove).toHaveBeenCalledWith("storage", onStorageChange);
+ });
+
+ it("returns a no-op cleanup without registering listeners on the server", () => {
+ isServerSideMock.mockReturnValue(true);
+ const documentAdd = vi.spyOn(document, "addEventListener");
+ const windowAdd = vi.spyOn(window, "addEventListener");
+
+ const listeners = setupSessionEventListeners(vi.fn(), vi.fn());
+
+ expect(documentAdd).not.toHaveBeenCalled();
+ expect(windowAdd).not.toHaveBeenCalled();
+ expect(() => listeners.cleanup()).not.toThrow();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/middleware.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/middleware.test.ts
new file mode 100644
index 0000000000..49decf89eb
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/middleware.test.ts
@@ -0,0 +1,144 @@
+import { NextRequest } from "next/server";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const getSessionCookie = vi.fn();
+const getCookieCache = vi.fn();
+
+vi.mock("better-auth/cookies", () => ({
+ getSessionCookie: (...args: unknown[]) => getSessionCookie(...args),
+ getCookieCache: (...args: unknown[]) => getCookieCache(...args),
+}));
+
+import { authMiddleware } from "../middleware";
+
+function makeRequest(path: string, cookies: Record<string, string> = {}) {
+ const request = new NextRequest(new URL(`http://localhost:3000${path}`));
+ for (const [name, value] of Object.entries(cookies)) {
+ request.cookies.set(name, value);
+ }
+ return request;
+}
+
+beforeEach(() => {
+ getSessionCookie.mockReset();
+ getCookieCache.mockReset();
+ getCookieCache.mockResolvedValue(null);
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+});
+
+describe("authMiddleware", () => {
+ it("passes through API routes without auth checks", async () => {
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(makeRequest("/api/auth/get-session"));
+
+ expect(response.headers.get("location")).toBeNull();
+ expect(getSessionCookie).not.toHaveBeenCalled();
+ });
+
+ it("redirects unauthenticated users on protected pages to login", async () => {
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(makeRequest("/copilot?foo=bar"));
+
+ const location = response.headers.get("location");
+ expect(location).toContain("/login");
+ expect(location).toContain(encodeURIComponent("/copilot?foo=bar"));
+ });
+
+ it("lets unauthenticated users browse public pages", async () => {
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(makeRequest("/marketplace"));
+
+ expect(response.headers.get("location")).toBeNull();
+ });
+
+ it("redirects legacy Supabase sessions to the bridge endpoint", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", "legacy-secret");
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(
+ makeRequest("/copilot", { "sb-proj-auth-token": "legacy" }),
+ );
+
+ const location = response.headers.get("location");
+ expect(location).toContain("/api/auth/supabase-bridge");
+ expect(location).toContain(encodeURIComponent("/copilot"));
+ });
+
+ it("sends legacy-cookie users to login, not the bridge, when the legacy secret is unset", async () => {
+ // The bridge can't consume cookies without SUPABASE_JWT_SECRET and
+ // deliberately leaves them intact — so bouncing there would loop
+ // middleware -> bridge -> /login -> middleware forever.
+ vi.stubEnv("SUPABASE_JWT_SECRET", "");
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(
+ makeRequest("/copilot", { "sb-proj-auth-token": "legacy" }),
+ );
+
+ const location = response.headers.get("location");
+ expect(location).toContain("/login");
+ expect(location).not.toContain("supabase-bridge");
+ });
+
+ it("lets legacy-cookie users browse public pages when the legacy secret is unset", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", "");
+ getSessionCookie.mockReturnValue(null);
+
+ const response = await authMiddleware(
+ makeRequest("/marketplace", { "sb-proj-auth-token": "legacy" }),
+ );
+
+ expect(response.headers.get("location")).toBeNull();
+ });
+
+ it("does not bridge when a Better Auth session already exists", async () => {
+ getSessionCookie.mockReturnValue("session-token");
+
+ const response = await authMiddleware(
+ makeRequest("/copilot", { "sb-proj-auth-token": "legacy" }),
+ );
+
+ expect(response.headers.get("location")).toBeNull();
+ });
+
+ it("redirects non-admin users away from admin pages", async () => {
+ getSessionCookie.mockReturnValue("session-token");
+ getCookieCache.mockResolvedValue({ user: { role: "user" } });
+
+ const response = await authMiddleware(makeRequest("/admin"));
+
+ expect(response.headers.get("location")).toBe("http://localhost:3000/");
+ });
+
+ it("lets admins through to admin pages via the cookie cache", async () => {
+ getSessionCookie.mockReturnValue("session-token");
+ getCookieCache.mockResolvedValue({ user: { role: "admin" } });
+
+ const response = await authMiddleware(makeRequest("/admin"));
+
+ expect(response.headers.get("location")).toBeNull();
+ });
+
+ it("falls back to the session endpoint when the cookie cache is empty", async () => {
+ getSessionCookie.mockReturnValue("session-token");
+ getCookieCache.mockResolvedValue(null);
+ const fetchSpy = vi.spyOn(globalThis, "fetch").mockResolvedValue(
+ new Response(JSON.stringify({ user: { role: "admin" } }), {
+ status: 200,
+ headers: { "content-type": "application/json" },
+ }),
+ );
+
+ const response = await authMiddleware(makeRequest("/admin"));
+
+ expect(fetchSpy).toHaveBeenCalled();
+ expect(response.headers.get("location")).toBeNull();
+ fetchSpy.mockRestore();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/service-token.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/service-token.test.ts
new file mode 100644
index 0000000000..e9b58d36b0
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/service-token.test.ts
@@ -0,0 +1,61 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const signJWTMock = vi.fn();
+vi.mock("better-auth/plugins/jwt", () => ({
+ signJWT: (...args: unknown[]) => signJWTMock(...args),
+}));
+
+const fakeAuthContext = { adapter: {}, secretConfig: "better-auth-secret" };
+vi.mock("../auth", () => ({
+ auth: { $context: Promise.resolve(fakeAuthContext) },
+}));
+
+import {
+ FRONTEND_SERVICE_SUBJECT,
+ mintServiceToken,
+ SERVICE_TOKEN_AUDIENCE,
+} from "../service-token";
+
+interface CapturedSignArgs {
+ options: { jwks: { keyPairConfig: { alg: string } } };
+ payload: {
+ sub: string;
+ aud: string;
+ scope: string;
+ iat: number;
+ exp: number;
+ };
+}
+
+beforeEach(() => {
+ signJWTMock.mockReset();
+ signJWTMock.mockResolvedValue("signed-service-token");
+});
+
+describe("mintServiceToken", () => {
+ it("signs with the Better Auth context and returns the token", async () => {
+ const token = await mintServiceToken("auth-email:send");
+
+ expect(token).toBe("signed-service-token");
+ expect(signJWTMock).toHaveBeenCalledTimes(1);
+ const [ctx] = signJWTMock.mock.calls[0] as [{ context: unknown }];
+ expect(ctx.context).toBe(fakeAuthContext);
+ });
+
+ it("mints a 60-second token with the service subject, audience, and scope", async () => {
+ await mintServiceToken("auth-email:send");
+
+ const [, config] = signJWTMock.mock.calls[0] as [unknown, CapturedSignArgs];
+ expect(config.payload.sub).toBe(FRONTEND_SERVICE_SUBJECT);
+ expect(config.payload.aud).toBe(SERVICE_TOKEN_AUDIENCE);
+ expect(config.payload.scope).toBe("auth-email:send");
+ expect(config.payload.exp - config.payload.iat).toBe(60);
+ });
+
+ it("pins the key algorithm to ES256 to match the jwt plugin config", async () => {
+ await mintServiceToken("auth-email:send");
+
+ const [, config] = signJWTMock.mock.calls[0] as [unknown, CapturedSignArgs];
+ expect(config.options.jwks.keyPairConfig.alg).toBe("ES256");
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/signup-gate.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/signup-gate.test.ts
new file mode 100644
index 0000000000..f35dbc753e
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/signup-gate.test.ts
@@ -0,0 +1,112 @@
+import { describe, expect, it } from "vitest";
+import {
+ isSignupAllowed,
+ parseAllowlist,
+ readSignupGateConfig,
+ type SignupGateConfig,
+} from "../signup-gate";
+
+describe("parseAllowlist", () => {
+ it("returns an empty list for unset / empty input", () => {
+ expect(parseAllowlist(undefined)).toEqual([]);
+ expect(parseAllowlist("")).toEqual([]);
+ expect(parseAllowlist(" , ,")).toEqual([]);
+ });
+
+ it("trims, lowercases, and drops blanks", () => {
+ expect(parseAllowlist(" [email protected] , @AGPT.co ,, [email protected]")).toEqual([
+ "@agpt.co",
+ ]);
+ });
+});
+
+describe("readSignupGateConfig", () => {
+ it("is open by default (prod posture) when env is unset", () => {
+ const cfg = readSignupGateConfig({});
+ expect(cfg).toEqual({ allowNewAccounts: true, allowlist: [] });
+ });
+
+ it("only an explicit 'false' disables new accounts", () => {
+ expect(
+ readSignupGateConfig({
+ AUTH_ALLOW_NEW_ACCOUNTS: "false",
+ }).allowNewAccounts,
+ ).toBe(false);
+ expect(
+ readSignupGateConfig({
+ AUTH_ALLOW_NEW_ACCOUNTS: "true",
+ }).allowNewAccounts,
+ ).toBe(true);
+ expect(
+ readSignupGateConfig({
+ AUTH_ALLOW_NEW_ACCOUNTS: "0",
+ }).allowNewAccounts,
+ ).toBe(true);
+ });
+
+ it("reads the allowlist from AUTH_SIGNUP_ALLOWLIST", () => {
+ expect(
+ readSignupGateConfig({
+ AUTH_SIGNUP_ALLOWLIST: "@agpt.co, [email protected]",
+ }).allowlist,
+ ).toEqual(["@agpt.co", "[email protected]"]);
+ });
+});
+
+const open: SignupGateConfig = { allowNewAccounts: true, allowlist: [] };
+
+describe("isSignupAllowed", () => {
+ it("allows anyone when open (no allowlist, accounts enabled)", () => {
+ expect(isSignupAllowed("[email protected]", open).allowed).toBe(true);
+ });
+
+ it("blocks everyone when new accounts are disabled, even if allowlisted", () => {
+ const cfg: SignupGateConfig = {
+ allowNewAccounts: false,
+ allowlist: ["[email protected]"],
+ };
+ const decision = isSignupAllowed("[email protected]", cfg);
+ expect(decision.allowed).toBe(false);
+ // Phrased so the frontend isWaitlistError() catches it.
+ expect(decision.reason?.toLowerCase()).toContain("not allowed");
+ });
+
+ it("allows an exact email match on the allowlist", () => {
+ const cfg: SignupGateConfig = {
+ allowNewAccounts: true,
+ allowlist: ["[email protected]"],
+ };
+ expect(isSignupAllowed("[email protected]", cfg).allowed).toBe(true);
+ expect(isSignupAllowed("[email protected]", cfg).allowed).toBe(true); // case-insensitive
+ });
+
+ it("allows a domain match via @domain entries", () => {
+ const cfg: SignupGateConfig = {
+ allowNewAccounts: true,
+ allowlist: ["@agpt.co"],
+ };
+ expect(isSignupAllowed("[email protected]", cfg).allowed).toBe(true);
+ expect(isSignupAllowed("[email protected]", cfg).allowed).toBe(true);
+ });
+
+ it("rejects an email that matches no allowlist entry", () => {
+ const cfg: SignupGateConfig = {
+ allowNewAccounts: true,
+ allowlist: ["@agpt.co", "[email protected]"],
+ };
+ const decision = isSignupAllowed("[email protected]", cfg);
+ expect(decision.allowed).toBe(false);
+ expect(decision.reason?.toLowerCase()).toContain("not allowed");
+ });
+
+ it("does not treat a domain entry as an email match or vice versa", () => {
+ expect(
+ isSignupAllowed("[email protected]", {
+ allowNewAccounts: true,
+ allowlist: ["@agpt.co"],
+ }).allowed,
+ ).toBe(false);
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/supabase-bridge.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/supabase-bridge.test.ts
new file mode 100644
index 0000000000..cc9aa00e51
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/supabase-bridge.test.ts
@@ -0,0 +1,212 @@
+import { SignJWT } from "jose";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { canConsumeLegacyCookies } from "../legacy-cookies";
+import {
+ parseSupabaseSessionCookie,
+ verifyLegacyToken,
+} from "../supabase-bridge";
+
+function encodeSession(session: object): string {
+ return encodeURIComponent(JSON.stringify(session));
+}
+
+describe("parseSupabaseSessionCookie", () => {
+ it("extracts the access token from a plain JSON cookie", () => {
+ const header = `sb-localhost-auth-token=${encodeSession({ access_token: "jwt-abc", refresh_token: "r" })}`;
+
+ const result = parseSupabaseSessionCookie(header);
+
+ expect(result.accessToken).toBe("jwt-abc");
+ expect(result.cookieNames).toEqual(["sb-localhost-auth-token"]);
+ });
+
+ it("decodes base64-prefixed session cookies", () => {
+ const payload = Buffer.from(
+ JSON.stringify({ access_token: "jwt-b64" }),
+ ).toString("base64");
+ const header = `sb-myproject-auth-token=base64-${payload}`;
+
+ const result = parseSupabaseSessionCookie(header);
+
+ expect(result.accessToken).toBe("jwt-b64");
+ });
+
+ it("reassembles chunked cookies in order", () => {
+ const raw = encodeSession({ access_token: "jwt-chunked" });
+ const mid = Math.floor(raw.length / 2);
+ const header = [
+ `sb-proj-auth-token.1=${raw.slice(mid)}`,
+ `sb-proj-auth-token.0=${raw.slice(0, mid)}`,
+ "other=1",
+ ].join("; ");
+
+ const result = parseSupabaseSessionCookie(header);
+
+ expect(result.accessToken).toBe("jwt-chunked");
+ expect(result.cookieNames).toEqual([
+ "sb-proj-auth-token.0",
+ "sb-proj-auth-token.1",
+ ]);
+ });
+
+ it("returns null when no supabase auth cookie is present", () => {
+ const result = parseSupabaseSessionCookie(
+ "better-auth.session_token=tok; theme=dark",
+ );
+
+ expect(result.accessToken).toBeNull();
+ expect(result.cookieNames).toEqual([]);
+ });
+
+ it("ignores unrelated sb- cookies that are not auth tokens", () => {
+ const result = parseSupabaseSessionCookie("sb-proj-refresh-meta=zzz");
+
+ expect(result.accessToken).toBeNull();
+ expect(result.cookieNames).toEqual([]);
+ });
+
+ it("reports cookie names even when the payload is malformed", () => {
+ const result = parseSupabaseSessionCookie(
+ "sb-proj-auth-token=not-valid-json",
+ );
+
+ expect(result.accessToken).toBeNull();
+ expect(result.cookieNames).toEqual(["sb-proj-auth-token"]);
+ });
+
+ it("returns null access token when the session has none", () => {
+ const header = `sb-proj-auth-token=${encodeSession({ refresh_token: "only" })}`;
+
+ const result = parseSupabaseSessionCookie(header);
+
+ expect(result.accessToken).toBeNull();
+ });
+});
+
+const LEGACY_SECRET = "legacy-supabase-jwt-secret-0123456789abcdef";
+
+async function signLegacyToken(
+ overrides: {
+ sub?: string;
+ audience?: string;
+ issuedAt?: number;
+ expiresAt?: number;
+ secret?: string;
+ } = {},
+): Promise<string> {
+ const now = Math.floor(Date.now() / 1000);
+ let builder = new SignJWT({})
+ .setProtectedHeader({ alg: "HS256" })
+ .setAudience(overrides.audience ?? "authenticated")
+ .setIssuedAt(overrides.issuedAt ?? now)
+ .setExpirationTime(overrides.expiresAt ?? now + 3600);
+
+ if (overrides.sub !== undefined) {
+ builder = builder.setSubject(overrides.sub);
+ }
+
+ return builder.sign(
+ new TextEncoder().encode(overrides.secret ?? LEGACY_SECRET),
+ );
+}
+
+describe("verifyLegacyToken", () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ it("returns the subject for a valid token", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ const token = await signLegacyToken({ sub: "user-123" });
+
+ expect(await verifyLegacyToken(token)).toBe("user-123");
+ });
+
+ it("accepts a token that expired within the bridge tolerance window", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ const now = Math.floor(Date.now() / 1000);
+ const token = await signLegacyToken({
+ sub: "user-123",
+ issuedAt: now - 3 * 60 * 60,
+ expiresAt: now - 2 * 60 * 60,
+ });
+
+ expect(await verifyLegacyToken(token)).toBe("user-123");
+ });
+
+ it("rejects an expired token when the tolerance window is zero", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ vi.stubEnv("SUPABASE_BRIDGE_MAX_TOKEN_AGE_DAYS", "0");
+ const now = Math.floor(Date.now() / 1000);
+ const token = await signLegacyToken({
+ sub: "user-123",
+ issuedAt: now - 3 * 60 * 60,
+ expiresAt: now - 2 * 60 * 60,
+ });
+
+ expect(await verifyLegacyToken(token)).toBeNull();
+ });
+
+ it("falls back to the default tolerance (not fail-open) when the age env is non-numeric", async () => {
+ // A non-numeric value made Number() -> NaN; clockTolerance: NaN made the
+ // expiry check always-false, accepting ANY expired token. Guard against it:
+ // a token expired well beyond the 30-day default must still be rejected.
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ vi.stubEnv("SUPABASE_BRIDGE_MAX_TOKEN_AGE_DAYS", "not-a-number");
+ const now = Math.floor(Date.now() / 1000);
+ const token = await signLegacyToken({
+ sub: "user-123",
+ issuedAt: now - 40 * 24 * 60 * 60,
+ expiresAt: now - 40 * 24 * 60 * 60,
+ });
+
+ expect(await verifyLegacyToken(token)).toBeNull();
+ });
+
+ it("rejects tokens minted for a different audience", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ const token = await signLegacyToken({
+ sub: "user-123",
+ audience: "service_role",
+ });
+
+ expect(await verifyLegacyToken(token)).toBeNull();
+ });
+
+ it("rejects everything when no SUPABASE_JWT_SECRET is configured", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", "");
+ const token = await signLegacyToken({ sub: "user-123" });
+
+ expect(await verifyLegacyToken(token)).toBeNull();
+ });
+
+ it("rejects garbage tokens", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+
+ expect(await verifyLegacyToken("not-a-jwt")).toBeNull();
+ });
+
+ it("returns null when the token has no subject", async () => {
+ vi.stubEnv("SUPABASE_JWT_SECRET", LEGACY_SECRET);
+ const token = await signLegacyToken();
+
+ expect(await verifyLegacyToken(token)).toBeNull();
+ });
+});
+
+describe("canConsumeLegacyCookies", () => {
+ it("refuses to consume the legacy cookie when no secret is configured", () => {
+ // Verification can only fail without the secret, so clearing the cookie
+ // first would turn a missing env var into permanent session loss: the
+ // cookie is gone before anyone notices, and configuring the secret
+ // afterwards can no longer recover the user's session.
+ expect(canConsumeLegacyCookies(undefined)).toBe(false);
+ expect(canConsumeLegacyCookies("")).toBe(false);
+ });
+
+ it("consumes it once the bridge can actually reach a verdict", () => {
+ // Clearing on every decided path is what stops the middleware redirecting
+ // back to the bridge forever.
+ expect(canConsumeLegacyCookies(LEGACY_SECRET)).toBe(true);
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/__tests__/types.test.ts b/autogpt_platform/frontend/src/lib/auth/__tests__/types.test.ts
new file mode 100644
index 0000000000..f79300ff6c
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/__tests__/types.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from "vitest";
+import { mapSessionUser } from "../types";
+
+describe("mapSessionUser", () => {
+ it("maps an admin user with role preserved", () => {
+ const user = mapSessionUser({
+ id: "user-1",
+ email: "[email protected]",
+ name: "Admin",
+ role: "admin",
+ createdAt: new Date("2026-01-02T03:04:05.000Z"),
+ });
+
+ expect(user).toEqual({
+ id: "user-1",
+ email: "[email protected]",
+ role: "admin",
+ created_at: "2026-01-02T03:04:05.000Z",
+ user_metadata: { name: "Admin", email: "[email protected]" },
+ });
+ });
+
+ it("normalizes non-admin roles to authenticated", () => {
+ expect(mapSessionUser({ id: "u", email: "[email protected]", role: "user" }).role).toBe(
+ "authenticated",
+ );
+ expect(mapSessionUser({ id: "u", email: "[email protected]", role: null }).role).toBe(
+ "authenticated",
+ );
+ });
+
+ it("passes string createdAt through unchanged", () => {
+ const user = mapSessionUser({
+ id: "u",
+ email: "[email protected]",
+ createdAt: "2026-05-06T00:00:00.000Z",
+ });
+
+ expect(user.created_at).toBe("2026-05-06T00:00:00.000Z");
+ });
+
+ it("leaves user_metadata.name undefined when the user has no name", () => {
+ const user = mapSessionUser({ id: "u", email: "[email protected]", name: null });
+
+ expect(user.user_metadata.name).toBeUndefined();
+ expect(user.user_metadata.email).toBe("[email protected]");
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/actions.ts b/autogpt_platform/frontend/src/lib/auth/actions.ts
new file mode 100644
index 0000000000..1f84871da5
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/actions.ts
@@ -0,0 +1,195 @@
+"use server";
+import { getServerAuthToken } from "@/lib/auth/server/getServerAuthToken";
+import * as Sentry from "@sentry/nextjs";
+import { cookies, headers } from "next/headers";
+import { auth } from "./auth";
+import { getRedirectPath } from "./helpers";
+import { getServerSession } from "./server/getServerSession";
+import { mapSessionUser, type User } from "./types";
+
+export interface SessionValidationResult {
+ user: User | null;
+ isValid: boolean;
+ redirectPath?: string;
+}
+
+export async function validateSession(
+ currentPath: string,
+): Promise<SessionValidationResult> {
+ return await Sentry.withServerActionInstrumentation(
+ "validateSession",
+ {},
+ async () => {
+ try {
+ const session = await getServerSession();
+
+ if (!session?.user) {
+ const redirectPath = getRedirectPath(currentPath);
+ return {
+ user: null,
+ isValid: false,
+ redirectPath: redirectPath || undefined,
+ };
+ }
+
+ return {
+ user: mapSessionUser(session.user),
+ isValid: true,
+ };
+ } catch (error) {
+ console.error("Session validation error:", error);
+ const redirectPath = getRedirectPath(currentPath);
+ return {
+ user: null,
+ isValid: false,
+ redirectPath: redirectPath || undefined,
+ };
+ }
+ },
+ );
+}
+
+export async function getCurrentUser(): Promise<{
+ user: User | null;
+ error?: string;
+}> {
+ return await Sentry.withServerActionInstrumentation(
+ "getCurrentUser",
+ {},
+ async () => {
+ try {
+ const session = await getServerSession();
+ return { user: session?.user ? mapSessionUser(session.user) : null };
+ } catch (error) {
+ console.error("Get current user error:", error);
+ return {
+ user: null,
+ error: error instanceof Error ? error.message : "Unknown error",
+ };
+ }
+ },
+ );
+}
+
+export async function getWebSocketToken(): Promise<{
+ token: string | null;
+ error?: string;
+}> {
+ return await Sentry.withServerActionInstrumentation(
+ "getWebSocketToken",
+ {},
+ async () => {
+ try {
+ const token = await getServerAuthToken();
+ return { token };
+ } catch (error) {
+ console.error("Get WebSocket token error:", error);
+ return {
+ token: null,
+ error: error instanceof Error ? error.message : "Unknown error",
+ };
+ }
+ },
+ );
+}
+
+export type ServerLogoutOptions = {
+ /**
+ * Revoke every session for the user, not just this device's.
+ *
+ * Pre-migration this mapped to Supabase's `signOut({ scope: "global" })`. It
+ * is intentionally absent rather than accepted-and-ignored: no caller passes
+ * it today, and an option that silently fails to revoke is worse than none.
+ * To restore it, branch here on `auth.api.revokeSessions`.
+ */
+ globalLogout?: never;
+};
+
+export async function serverLogout(_options: ServerLogoutOptions = {}) {
+ return await Sentry.withServerActionInstrumentation(
+ "serverLogout",
+ {},
+ async () => {
+ try {
+ // Better Auth's signOut revokes the current session and clears the
+ // cookie; other devices' sessions stay valid (matching the previous
+ // default "local" scope).
+ await auth.api.signOut({ headers: await headers() });
+ } catch (error) {
+ // Cookies are cleared below regardless, so the user is logged out
+ // locally — but the session row may still be live, which matters if
+ // the token was stolen. Surface it rather than only console.error.
+ console.error("Logout error:", error);
+ Sentry.captureException(error);
+ }
+
+ // Always expire the auth cookies, even when signOut() fails (revoked or
+ // already-rotated session token, auth API hiccup). If they survive, the
+ // middleware still sees a session and bounces the user from /login
+ // straight back into the app with a half-dead session: the paywall
+ // re-mounts while every API call fails with a 401.
+ await clearAuthCookies();
+
+ // No `revalidatePath`: `/` is a client-only spinner that redirects to
+ // `/copilot`, so there is no RSC payload to invalidate. The cross-tab
+ // storage listener calls `router.refresh()` for any visible page, and
+ // the React Query cache is cleared client-side.
+ return { success: true };
+ },
+ );
+}
+
+// Better Auth stores the session in `better-auth.session_token` /
+// `better-auth.session_data` cookies (prefixed `__Secure-` over HTTPS).
+// Also sweep any leftover `sb-`-prefixed Supabase cookies so a user mid-
+// migration is fully signed out.
+async function clearAuthCookies() {
+ const cookieStore = await cookies();
+ for (const cookie of cookieStore.getAll()) {
+ if (
+ cookie.name.startsWith("better-auth.") ||
+ cookie.name.startsWith("__Secure-better-auth.") ||
+ cookie.name.startsWith("sb-")
+ ) {
+ // A bare cookies().delete(name) emits a Set-Cookie WITHOUT `Secure`, which
+ // the browser REJECTS for `__Secure-`-prefixed cookies over HTTPS (the
+ // prefix mandates Secure). The session_token/session_data then survive and
+ // the user "logs out" but /login bounces them straight back into the app.
+ // Overwrite with an expired cookie carrying matching attributes so the
+ // deletion is accepted on both HTTP (local) and HTTPS (deployed).
+ cookieStore.set(cookie.name, "", {
+ maxAge: 0,
+ path: "/",
+ httpOnly: true,
+ sameSite: "lax",
+ secure: cookie.name.startsWith("__Secure-"),
+ });
+ }
+ }
+}
+
+export async function refreshSession() {
+ return await Sentry.withServerActionInstrumentation(
+ "refreshSession",
+ {},
+ async () => {
+ try {
+ // Cookie sessions don't need an explicit token refresh; re-reading
+ // the session is enough to confirm (and slide) it.
+ const session = await getServerSession();
+
+ if (!session?.user) {
+ return { user: null, error: "No active session" };
+ }
+
+ return { user: mapSessionUser(session.user) };
+ } catch (error) {
+ console.error("Refresh session error:", error);
+ return {
+ user: null,
+ error: error instanceof Error ? error.message : "Unknown error",
+ };
+ }
+ },
+ );
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/auth.ts b/autogpt_platform/frontend/src/lib/auth/auth.ts
new file mode 100644
index 0000000000..5823d14bb4
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/auth.ts
@@ -0,0 +1,227 @@
+import { betterAuth } from "better-auth";
+import { APIError } from "better-auth/api";
+import { nextCookies } from "better-auth/next-js";
+import { admin, jwt } from "better-auth/plugins";
+import { compare, hash } from "bcryptjs";
+import { Pool } from "pg";
+import { mirrorVerifiedEmailToPlatformUser } from "./email-mirror";
+import { sendAuthEmail } from "./email";
+import { JWKS_ALG } from "./service-token";
+import { isSignupAllowed, readSignupGateConfig } from "./signup-gate";
+import { supabaseBridge } from "./supabase-bridge";
+
+const baseURL =
+ process.env.BETTER_AUTH_URL ||
+ process.env.NEXT_PUBLIC_FRONTEND_BASE_URL ||
+ "http://localhost:3000";
+
+function getSocialProviders() {
+ const providers: Record<string, { clientId: string; clientSecret: string }> =
+ {};
+
+ for (const provider of ["google", "github", "discord"] as const) {
+ const prefix = `AUTH_${provider.toUpperCase()}`;
+ const clientId = process.env[`${prefix}_CLIENT_ID`];
+ const clientSecret = process.env[`${prefix}_CLIENT_SECRET`];
+ if (clientId && clientSecret) {
+ providers[provider] = { clientId, clientSecret };
+ }
+ }
+
+ return providers;
+}
+
+// Shared with the databaseHooks below so the verified-email mirror reuses the
+// same connection/search_path instead of opening a second pool.
+// Cached on globalThis in development: `next dev` re-evaluates this module on
+// every hot reload, and a fresh Pool per reload leaks its idle connections
+// (the old one is never ended), eventually exhausting Postgres backends.
+// Production evaluates it once, so the cache is a no-op there.
+const globalForAuthDb = globalThis as { __authDbPool?: Pool };
+
+const authDbPool =
+ globalForAuthDb.__authDbPool ??
+ new Pool({
+ // Fallback matches the docker-compose db service so `make run-frontend`
+ // works against `make start-core` without a frontend/.env, mirroring the
+ // localhost fallbacks in services/environment. Production must set
+ // DATABASE_URL explicitly.
+ connectionString:
+ process.env.DATABASE_URL ||
+ "postgresql://postgres:your-super-secret-and-long-postgres-password@localhost:5432/postgres",
+ // Better Auth shares the platform Postgres; its tables live in the same
+ // schema as the Prisma-managed ones (created by the backend migrations).
+ options: `-c search_path=${process.env.AUTH_DB_SCHEMA || "platform"}`,
+ });
+
+if (process.env.NODE_ENV !== "production") {
+ globalForAuthDb.__authDbPool = authDbPool;
+}
+
+export const auth = betterAuth({
+ baseURL,
+ secret: process.env.BETTER_AUTH_SECRET,
+ database: authDbPool,
+ telemetry: { enabled: false },
+ databaseHooks: {
+ user: {
+ create: {
+ // Env-driven signup gate (see signup-gate.ts). Fires for both
+ // email/password signup AND a first OAuth sign-in, since both create
+ // a user row. Existing users and the SQL data-migration bypass it.
+ // The thrown message is phrased so the frontend `isWaitlistError()`
+ // maps it to the existing "not allowed" modal.
+ before: async (user: { email: string }) => {
+ const decision = isSignupAllowed(user.email, readSignupGateConfig());
+ if (!decision.allowed) {
+ throw new APIError("FORBIDDEN", {
+ message: decision.reason ?? "Signups are not allowed.",
+ });
+ }
+ },
+ },
+ update: {
+ // updateUserByEmail (fired when a change-email link is confirmed)
+ // runs this hook post-commit; mirror the now-verified email onto the
+ // platform User row so notifications/Stripe track the confirmed
+ // identity. See email-mirror.ts for the why.
+ after: async (user: { id: string; email: string }) => {
+ await mirrorVerifiedEmailToPlatformUser(authDbPool, user);
+ },
+ },
+ },
+ },
+ advanced: {
+ database: {
+ // Keep UUID ids: platform User rows reuse the auth user id, and all
+ // pre-migration ids are Supabase UUIDs.
+ generateId: () => crypto.randomUUID(),
+ },
+ },
+ session: {
+ modelName: "UserAuthSession",
+ expiresIn: 60 * 60 * 24 * 30, // 30 days, matching GoTrue refresh longevity
+ updateAge: 60 * 60 * 24,
+ cookieCache: {
+ enabled: true,
+ maxAge: 5 * 60,
+ },
+ },
+ // Table names are overridden away from Better Auth's defaults (user,
+ // session, ...) so the auth tables read unambiguously next to the platform
+ // tables — most importantly no `user` table case-colliding with `User`.
+ account: {
+ modelName: "UserAuthAccount",
+ },
+ verification: {
+ modelName: "UserAuthVerification",
+ },
+ emailAndPassword: {
+ enabled: true,
+ // The 12-char policy has to hold on the raw Better Auth endpoints too
+ // (/sign-up/email, /reset-password, /change-password) — the signup server
+ // action's zod schema only guards the form path, so a direct POST would
+ // otherwise slip a 6-char password through. minPasswordLength is checked
+ // when a password is *set* (sign-up / reset / change), never on sign-in,
+ // so this does NOT lock out migrated users whose old password is shorter.
+ minPasswordLength: 12,
+ // A password reset kicks every active session, matching the previous
+ // flow's signOut({ scope: "global" }) — the standard defense when a
+ // user resets their password to evict a stolen session.
+ revokeSessionsOnPasswordReset: true,
+ requireEmailVerification:
+ process.env.AUTH_REQUIRE_EMAIL_VERIFICATION === "true",
+ password: {
+ // bcrypt instead of Better Auth's default scrypt so password hashes
+ // migrated from Supabase GoTrue keep verifying without a reset.
+ hash: (password) => hash(password, 10),
+ verify: ({ hash: hashValue, password }) => compare(password, hashValue),
+ },
+ sendResetPassword: async ({ user, url }) => {
+ await sendAuthEmail({
+ to: user.email,
+ type: "reset_password",
+ url,
+ });
+ },
+ },
+ emailVerification: {
+ sendVerificationEmail: async ({ user, url }) => {
+ await sendAuthEmail({
+ to: user.email,
+ type: "verify_email",
+ url,
+ });
+ },
+ },
+ user: {
+ modelName: "UserAuthIdentity",
+ additionalFields: {
+ // Onboarding's "What should I call you?" answer; surfaced to
+ // consumers as user_metadata.preferred_name (see mapSessionUser).
+ preferredName: {
+ type: "string",
+ required: false,
+ },
+ },
+ changeEmail: {
+ // Off by default in Better Auth; the settings page's email form
+ // depends on it. Verified users (the migration carries Supabase's
+ // email_confirmed_at across as emailVerified) approve the change via a
+ // confirmation link sent to their CURRENT address. That's the
+ // anti-takeover protection Supabase's secure-email-change gave us, so
+ // the backend mailer (Postmark) must be configured for it to work in
+ // production. Unverified users (email verification is off) have the
+ // change applied immediately with no email. `sendChangeEmailVerification`
+ // is NOT a Better Auth key; the real ones are `sendChangeEmailConfirmation`
+ // (verified path) + `updateEmailWithoutVerification` (unverified path).
+ enabled: true,
+ updateEmailWithoutVerification: true,
+ sendChangeEmailConfirmation: async ({
+ user,
+ url,
+ }: {
+ user: { email: string };
+ newEmail: string;
+ url: string;
+ token: string;
+ }) => {
+ await sendAuthEmail({
+ to: user.email,
+ type: "change_email",
+ url,
+ });
+ },
+ },
+ },
+ socialProviders: getSocialProviders(),
+ plugins: [
+ admin(),
+ jwt({
+ schema: {
+ jwks: { modelName: "UserAuthJwks" },
+ },
+ jwks: {
+ // Shared with mintServiceToken — whichever signs first creates the
+ // JWKS keypair, so the two must never disagree.
+ keyPairConfig: { alg: JWKS_ALG },
+ },
+ jwt: {
+ issuer: baseURL,
+ // The Python backend validates `aud == "authenticated"` — the same
+ // audience Supabase GoTrue used, so old and new tokens are
+ // interchangeable during the migration window.
+ audience: "authenticated",
+ expirationTime: "1h",
+ definePayload: ({ user }) => ({
+ email: user.email,
+ role: user.role === "admin" ? "admin" : "authenticated",
+ user_metadata: { name: user.name },
+ }),
+ },
+ }),
+ supabaseBridge(),
+ // Must be last so cookies set inside server actions stick.
+ nextCookies(),
+ ],
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/client.ts b/autogpt_platform/frontend/src/lib/auth/client.ts
new file mode 100644
index 0000000000..9470e8b403
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/client.ts
@@ -0,0 +1,8 @@
+"use client";
+
+import { adminClient } from "better-auth/client/plugins";
+import { createAuthClient } from "better-auth/react";
+
+export const authClient = createAuthClient({
+ plugins: [adminClient()],
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/email-mirror.ts b/autogpt_platform/frontend/src/lib/auth/email-mirror.ts
new file mode 100644
index 0000000000..3b722d4250
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/email-mirror.ts
@@ -0,0 +1,28 @@
+import type { Pool } from "pg";
+
+// Mirror the *verified* auth email onto the platform `User` row (a separate
+// table sharing this id + schema). Better Auth applies an email change only
+// after the user clicks the confirmation link and fires its update hook
+// post-commit, so platform User.email — which drives notifications and Stripe —
+// converges on the confirmed identity instead of an unverified value the
+// settings form used to write eagerly. Idempotent (the `email <> $1` guard
+// skips no-op writes); self-heals any prior drift. Narrowed to `query` so it's
+// trivially testable with a fake pool.
+export async function mirrorVerifiedEmailToPlatformUser(
+ pool: Pick<Pool, "query">,
+ user: { id: string; email: string },
+) {
+ try {
+ await pool.query(
+ 'UPDATE "User" SET email = $1, "updatedAt" = NOW() WHERE id = $2 AND email <> $1',
+ [user.email, user.id],
+ );
+ } catch (error) {
+ // Non-fatal: the JWT already carries the verified email and the next user
+ // update retries the mirror. Never block the auth flow on this write.
+ console.error(
+ "Failed to mirror verified auth email to platform User",
+ error,
+ );
+ }
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/email.ts b/autogpt_platform/frontend/src/lib/auth/email.ts
new file mode 100644
index 0000000000..3a9797d7d4
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/email.ts
@@ -0,0 +1,53 @@
+import { environment } from "@/services/environment";
+import { mintServiceToken } from "./service-token";
+
+export type AuthEmailType = "reset_password" | "verify_email" | "change_email";
+
+interface SendAuthEmailArgs {
+ to: string;
+ type: AuthEmailType;
+ url: string;
+}
+
+/**
+ * Delivers a Better Auth transactional email (password reset, verification,
+ * email change) by POSTing the action link to the backend, which owns the
+ * Postmark credential and builds the message from `type`. The call is
+ * authenticated with a short-lived frontend service token signed by the
+ * Better Auth JWKS key the backend already trusts — no shared secret to
+ * configure on either side.
+ *
+ * In production a failed mint/send throws so an "email sent" UI can't lie
+ * about an undeliverable message. Elsewhere the action link is logged to the
+ * server console instead (local backends usually have no Postmark credential).
+ */
+export async function sendAuthEmail({ to, type, url }: SendAuthEmailArgs) {
+ try {
+ const token = await mintServiceToken("auth-email:send");
+ const endpoint = `${environment.getAGPTServerBaseUrl()}/api/auth/email/send`;
+ const response = await fetch(endpoint, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${token}`,
+ },
+ body: JSON.stringify({ type, to, url }),
+ });
+
+ if (!response.ok) {
+ const detail = await response.text().catch(() => "");
+ throw new Error(
+ `Backend auth-email send failed (${response.status}) for "${type}"` +
+ (detail ? `: ${detail.slice(0, 200)}` : ""),
+ );
+ }
+ } catch (error) {
+ if (process.env.NODE_ENV === "production") {
+ throw error;
+ }
+ console.info(
+ `[auth-email] Send failed (${error}). ${type} link for ${to}:`,
+ );
+ console.info(`[auth-email] ${url}`);
+ }
+}
diff --git a/autogpt_platform/frontend/src/lib/supabase/helpers.ts b/autogpt_platform/frontend/src/lib/auth/helpers.ts
similarity index 70%
rename from autogpt_platform/frontend/src/lib/supabase/helpers.ts
rename to autogpt_platform/frontend/src/lib/auth/helpers.ts
index efb4b5fe4d..74d3285dfb 100644
--- a/autogpt_platform/frontend/src/lib/supabase/helpers.ts
+++ b/autogpt_platform/frontend/src/lib/auth/helpers.ts
@@ -1,7 +1,5 @@
import { environment } from "@/services/environment";
import { Key, storage } from "@/services/storage/local-storage";
-import { type CookieOptions } from "@supabase/ssr";
-import { SupabaseClient } from "@supabase/supabase-js";
export const PROTECTED_PAGES = [
"/auth/authorize",
@@ -18,14 +16,6 @@ export const PROTECTED_PAGES = [
export const ADMIN_PAGES = ["/admin"] as const;
-export function getCookieSettings(): Partial<CookieOptions> {
- return {
- secure: process.env.NODE_ENV === "production",
- sameSite: "lax",
- httpOnly: true,
- } as const;
-}
-
// Page protection utilities
export function isProtectedPage(pathname: string): boolean {
return PROTECTED_PAGES.some((page) => pathname.startsWith(page));
@@ -101,38 +91,3 @@ export function setupSessionEventListeners(
},
};
}
-
-export interface CodeExchangeResult {
- success: boolean;
- error?: string;
-}
-
-export async function exchangePasswordResetCode(
- supabase: SupabaseClient<any, "public", any>,
- code: string,
-): Promise<CodeExchangeResult> {
- try {
- const { data, error } = await supabase.auth.exchangeCodeForSession(code);
-
- if (error) {
- return {
- success: false,
- error: error.message,
- };
- }
-
- if (!data.session) {
- return {
- success: false,
- error: "Failed to create session",
- };
- }
-
- return { success: true };
- } catch (error) {
- return {
- success: false,
- error: error instanceof Error ? error.message : "Unknown error",
- };
- }
-}
diff --git a/autogpt_platform/frontend/src/lib/auth/hooks/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/lib/auth/hooks/__tests__/helpers.test.ts
new file mode 100644
index 0000000000..e4cc5cafbb
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/hooks/__tests__/helpers.test.ts
@@ -0,0 +1,268 @@
+import type BackendAPI from "@/lib/autogpt-server-api/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { User } from "../../types";
+
+const getCurrentUserMock = vi.fn();
+const validateSessionActionMock = vi.fn();
+const refreshSessionActionMock = vi.fn();
+const clearWebSocketDisconnectIntentMock = vi.fn();
+const setWebSocketDisconnectIntentMock = vi.fn();
+const getRedirectPathMock = vi.fn();
+const isLogoutEventMock = vi.fn();
+
+vi.mock("../../actions", () => ({
+ getCurrentUser: () => getCurrentUserMock(),
+ validateSession: (...args: unknown[]) => validateSessionActionMock(...args),
+ refreshSession: () => refreshSessionActionMock(),
+}));
+
+vi.mock("../../helpers", () => ({
+ clearWebSocketDisconnectIntent: () => clearWebSocketDisconnectIntentMock(),
+ setWebSocketDisconnectIntent: () => setWebSocketDisconnectIntentMock(),
+ getRedirectPath: (...args: unknown[]) => getRedirectPathMock(...args),
+ isLogoutEvent: (...args: unknown[]) => isLogoutEventMock(...args),
+}));
+
+import {
+ fetchUser,
+ handleStorageEvent,
+ refreshSession,
+ validateSession,
+} from "../helpers";
+
+function makeUser(id: string): User {
+ return {
+ id,
+ email: `${id}@example.com`,
+ role: "authenticated",
+ user_metadata: {},
+ };
+}
+
+beforeEach(() => {
+ getCurrentUserMock.mockReset();
+ validateSessionActionMock.mockReset();
+ refreshSessionActionMock.mockReset();
+ clearWebSocketDisconnectIntentMock.mockReset();
+ setWebSocketDisconnectIntentMock.mockReset();
+ getRedirectPathMock.mockReset();
+ isLogoutEventMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("fetchUser", () => {
+ it("returns the user and clears the websocket disconnect intent", async () => {
+ const user = makeUser("user-1");
+ getCurrentUserMock.mockResolvedValue({ user });
+
+ const result = await fetchUser();
+
+ expect(result).toEqual({
+ user,
+ hasLoadedUser: true,
+ isUserLoading: false,
+ });
+ expect(clearWebSocketDisconnectIntentMock).toHaveBeenCalled();
+ });
+
+ it("keeps hasLoadedUser false when there is no user and no error", async () => {
+ getCurrentUserMock.mockResolvedValue({ user: null });
+
+ const result = await fetchUser();
+
+ expect(result).toEqual({
+ user: null,
+ hasLoadedUser: false,
+ isUserLoading: false,
+ });
+ expect(clearWebSocketDisconnectIntentMock).not.toHaveBeenCalled();
+ });
+
+ it("marks the user as loaded when the action reports an error", async () => {
+ getCurrentUserMock.mockResolvedValue({ user: null, error: "boom" });
+
+ const result = await fetchUser();
+
+ expect(result).toEqual({
+ user: null,
+ hasLoadedUser: true,
+ isUserLoading: false,
+ });
+ });
+
+ it("marks the user as loaded when the action throws", async () => {
+ getCurrentUserMock.mockRejectedValue(new Error("network down"));
+
+ const result = await fetchUser();
+
+ expect(result).toEqual({
+ user: null,
+ hasLoadedUser: true,
+ isUserLoading: false,
+ });
+ });
+});
+
+describe("validateSession", () => {
+ it("returns the redirect path and requests a user update for invalid sessions", async () => {
+ validateSessionActionMock.mockResolvedValue({
+ user: null,
+ isValid: false,
+ redirectPath: "/login?next=%2Fcopilot",
+ });
+
+ const result = await validateSession({
+ path: "/copilot",
+ currentUser: makeUser("user-1"),
+ });
+
+ expect(result).toEqual({
+ isValid: false,
+ redirectPath: "/login?next=%2Fcopilot",
+ shouldUpdateUser: true,
+ });
+ });
+
+ it("requests a user update when the session user changed", async () => {
+ const newUser = makeUser("user-2");
+ validateSessionActionMock.mockResolvedValue({
+ user: newUser,
+ isValid: true,
+ });
+
+ const result = await validateSession({
+ path: "/copilot",
+ currentUser: makeUser("user-1"),
+ });
+
+ expect(result).toEqual({
+ isValid: true,
+ user: newUser,
+ shouldUpdateUser: true,
+ });
+ expect(clearWebSocketDisconnectIntentMock).toHaveBeenCalled();
+ });
+
+ it("skips the user update when the session user is unchanged", async () => {
+ const user = makeUser("user-1");
+ validateSessionActionMock.mockResolvedValue({ user, isValid: true });
+
+ const result = await validateSession({
+ path: "/copilot",
+ currentUser: user,
+ });
+
+ expect(result.shouldUpdateUser).toBe(false);
+ expect(result.isValid).toBe(true);
+ });
+
+ it("stays valid without updating when the action returns no user", async () => {
+ validateSessionActionMock.mockResolvedValue({ user: null, isValid: true });
+
+ const result = await validateSession({
+ path: "/copilot",
+ currentUser: null,
+ });
+
+ expect(result).toEqual({ isValid: true, shouldUpdateUser: false });
+ });
+
+ it("falls back to the helper redirect path when the action throws", async () => {
+ validateSessionActionMock.mockRejectedValue(new Error("server gone"));
+ getRedirectPathMock.mockReturnValue("/login?next=%2Fcopilot");
+
+ const result = await validateSession({
+ path: "/copilot",
+ currentUser: makeUser("user-1"),
+ });
+
+ expect(getRedirectPathMock).toHaveBeenCalledWith("/copilot");
+ expect(result).toEqual({
+ isValid: false,
+ redirectPath: "/login?next=%2Fcopilot",
+ shouldUpdateUser: true,
+ });
+ });
+});
+
+describe("refreshSession", () => {
+ it("clears the websocket disconnect intent when a user is returned", async () => {
+ const user = makeUser("user-1");
+ refreshSessionActionMock.mockResolvedValue({ user });
+
+ const result = await refreshSession();
+
+ expect(result).toEqual({ user });
+ expect(clearWebSocketDisconnectIntentMock).toHaveBeenCalled();
+ });
+
+ it("leaves the websocket disconnect intent alone when no user is returned", async () => {
+ refreshSessionActionMock.mockResolvedValue({
+ user: null,
+ error: "No active session",
+ });
+
+ const result = await refreshSession();
+
+ expect(result).toEqual({ user: null, error: "No active session" });
+ expect(clearWebSocketDisconnectIntentMock).not.toHaveBeenCalled();
+ });
+});
+
+describe("handleStorageEvent", () => {
+ it("ignores storage events that are not logout broadcasts", () => {
+ isLogoutEventMock.mockReturnValue(false);
+ const disconnectWebSocket = vi.fn();
+ const api = { disconnectWebSocket } as unknown as BackendAPI;
+
+ const result = handleStorageEvent({
+ event: new StorageEvent("storage", { key: "theme" }),
+ api,
+ router: null,
+ path: "/copilot",
+ });
+
+ expect(result).toEqual({ shouldLogout: false });
+ expect(setWebSocketDisconnectIntentMock).not.toHaveBeenCalled();
+ expect(disconnectWebSocket).not.toHaveBeenCalled();
+ });
+
+ it("disconnects the websocket and returns the redirect path on logout", () => {
+ isLogoutEventMock.mockReturnValue(true);
+ getRedirectPathMock.mockReturnValue("/login?next=%2Fcopilot");
+ const disconnectWebSocket = vi.fn();
+ const api = { disconnectWebSocket } as unknown as BackendAPI;
+
+ const result = handleStorageEvent({
+ event: new StorageEvent("storage", { key: "supabase-logout" }),
+ api,
+ router: null,
+ path: "/copilot",
+ });
+
+ expect(setWebSocketDisconnectIntentMock).toHaveBeenCalled();
+ expect(disconnectWebSocket).toHaveBeenCalled();
+ expect(result).toEqual({
+ shouldLogout: true,
+ redirectPath: "/login?next=%2Fcopilot",
+ });
+ });
+
+ it("handles logout without an api client", () => {
+ isLogoutEventMock.mockReturnValue(true);
+ getRedirectPathMock.mockReturnValue(null);
+
+ const result = handleStorageEvent({
+ event: new StorageEvent("storage", { key: "supabase-logout" }),
+ api: null,
+ router: null,
+ path: "/marketplace",
+ });
+
+ expect(result).toEqual({ shouldLogout: true, redirectPath: null });
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/supabase/hooks/__tests__/useSupabaseStore.test.ts b/autogpt_platform/frontend/src/lib/auth/hooks/__tests__/useAuthStore.test.ts
similarity index 76%
rename from autogpt_platform/frontend/src/lib/supabase/hooks/__tests__/useSupabaseStore.test.ts
rename to autogpt_platform/frontend/src/lib/auth/hooks/__tests__/useAuthStore.test.ts
index a363f2abe8..e778b3b54e 100644
--- a/autogpt_platform/frontend/src/lib/supabase/hooks/__tests__/useSupabaseStore.test.ts
+++ b/autogpt_platform/frontend/src/lib/auth/hooks/__tests__/useAuthStore.test.ts
@@ -2,10 +2,10 @@ import type BackendAPI from "@/lib/autogpt-server-api/client";
import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import { afterEach, describe, expect, it, vi } from "vitest";
-// The store imports a chain of modules (server actions, supabase helpers,
-// react-query). Stub them so we can exercise `setCurrentRequestContext` —
-// the new behavior introduced by this PR — in isolation, without pulling
-// in next/headers or a real Supabase client at test time.
+// The store imports a chain of modules (server actions, auth helpers,
+// react-query). Stub them so we can exercise `setCurrentRequestContext`
+// in isolation, without pulling in next/headers or the Better Auth server
+// instance at test time.
vi.mock("../../actions", () => ({
serverLogout: vi.fn(),
}));
@@ -15,16 +15,15 @@ vi.mock("../../helpers", () => ({
setupSessionEventListeners: vi.fn(() => ({ cleanup: vi.fn() })),
}));
vi.mock("../helpers", () => ({
- ensureSupabaseClient: vi.fn(() => null),
fetchUser: vi.fn(),
handleStorageEvent: vi.fn(),
refreshSession: vi.fn(),
validateSession: vi.fn(),
}));
-import type { User } from "@supabase/supabase-js";
+import type { User } from "../../types";
import { validateSession as validateSessionHelper } from "../helpers";
-import { useSupabaseStore } from "../useSupabaseStore";
+import { useAuthStore } from "../useAuthStore";
function makeRouter() {
return {
@@ -42,13 +41,13 @@ function makeApi() {
}
function snapshot() {
- const { routerRef, apiRef, currentPath } = useSupabaseStore.getState();
+ const { routerRef, apiRef, currentPath } = useAuthStore.getState();
return { routerRef, apiRef, currentPath };
}
-describe("useSupabaseStore.setCurrentRequestContext", () => {
+describe("useAuthStore.setCurrentRequestContext", () => {
afterEach(() => {
- useSupabaseStore.setState({
+ useAuthStore.setState({
routerRef: null,
apiRef: null,
currentPath: "",
@@ -59,7 +58,7 @@ describe("useSupabaseStore.setCurrentRequestContext", () => {
const router = makeRouter();
const api = makeApi();
- useSupabaseStore
+ useAuthStore
.getState()
.setCurrentRequestContext({ router, api, path: "/library" });
@@ -73,10 +72,10 @@ describe("useSupabaseStore.setCurrentRequestContext", () => {
it("is a no-op when refs and path are identical to current state", () => {
const router = makeRouter();
const api = makeApi();
- const { setCurrentRequestContext } = useSupabaseStore.getState();
+ const { setCurrentRequestContext } = useAuthStore.getState();
setCurrentRequestContext({ router, api, path: "/library" });
- const setSpy = vi.spyOn(useSupabaseStore, "setState");
+ const setSpy = vi.spyOn(useAuthStore, "setState");
setCurrentRequestContext({ router, api, path: "/library" });
@@ -102,7 +101,7 @@ describe("useSupabaseStore.setCurrentRequestContext", () => {
const baseApi = makeApi();
const basePath = "/library";
- const { setCurrentRequestContext } = useSupabaseStore.getState();
+ const { setCurrentRequestContext } = useAuthStore.getState();
setCurrentRequestContext({
router: baseRouter,
api: baseApi,
@@ -122,9 +121,9 @@ describe("useSupabaseStore.setCurrentRequestContext", () => {
});
});
-describe("useSupabaseStore.validateSession", () => {
+describe("useAuthStore.validateSession", () => {
afterEach(() => {
- useSupabaseStore.setState({
+ useAuthStore.setState({
user: null,
hasLoadedUser: false,
isUserLoading: false,
@@ -142,19 +141,19 @@ describe("useSupabaseStore.validateSession", () => {
redirectPath: "/login?next=%2Fbuild",
shouldUpdateUser: false,
});
- useSupabaseStore.setState({
+ useAuthStore.setState({
user: { id: "user-1" } as User,
hasLoadedUser: true,
});
- const stillValid = await useSupabaseStore.getState().validateSession({
+ const stillValid = await useAuthStore.getState().validateSession({
router,
path: "/build",
force: true,
});
expect(stillValid).toBe(false);
- expect(useSupabaseStore.getState().user).toBeNull();
+ expect(useAuthStore.getState().user).toBeNull();
expect(router.push).toHaveBeenCalledWith("/login?next=%2Fbuild");
});
@@ -166,16 +165,16 @@ describe("useSupabaseStore.validateSession", () => {
isValid: true,
shouldUpdateUser: false,
});
- useSupabaseStore.setState({ user, hasLoadedUser: true });
+ useAuthStore.setState({ user, hasLoadedUser: true });
- const stillValid = await useSupabaseStore.getState().validateSession({
+ const stillValid = await useAuthStore.getState().validateSession({
router,
path: "/build",
force: true,
});
expect(stillValid).toBe(true);
- expect(useSupabaseStore.getState().user).toBe(user);
+ expect(useAuthStore.getState().user).toBe(user);
expect(router.push).not.toHaveBeenCalled();
});
});
diff --git a/autogpt_platform/frontend/src/lib/supabase/hooks/helpers.ts b/autogpt_platform/frontend/src/lib/auth/hooks/helpers.ts
similarity index 80%
rename from autogpt_platform/frontend/src/lib/supabase/hooks/helpers.ts
rename to autogpt_platform/frontend/src/lib/auth/hooks/helpers.ts
index 95b9e8bbca..9772e64510 100644
--- a/autogpt_platform/frontend/src/lib/supabase/hooks/helpers.ts
+++ b/autogpt_platform/frontend/src/lib/auth/hooks/helpers.ts
@@ -1,7 +1,4 @@
import type BackendAPI from "@/lib/autogpt-server-api/client";
-import { environment } from "@/services/environment";
-import { createBrowserClient } from "@supabase/ssr";
-import type { SupabaseClient, User } from "@supabase/supabase-js";
import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import {
getCurrentUser,
@@ -14,31 +11,7 @@ import {
isLogoutEvent,
setWebSocketDisconnectIntent,
} from "../helpers";
-
-let supabaseSingleton: SupabaseClient | null = null;
-
-export function ensureSupabaseClient(): SupabaseClient | null {
- if (supabaseSingleton) return supabaseSingleton;
-
- const supabaseUrl = environment.getSupabaseUrl();
- const supabaseKey = environment.getSupabaseAnonKey();
-
- if (!supabaseUrl || !supabaseKey) return null;
-
- try {
- supabaseSingleton = createBrowserClient(supabaseUrl, supabaseKey, {
- isSingleton: true,
- auth: {
- persistSession: false,
- },
- });
- } catch (error) {
- console.error("Error creating Supabase client", error);
- supabaseSingleton = null;
- }
-
- return supabaseSingleton;
-}
+import type { User } from "../types";
interface FetchUserResult {
user: User | null;
diff --git a/autogpt_platform/frontend/src/lib/supabase/hooks/useSupabase.ts b/autogpt_platform/frontend/src/lib/auth/hooks/useAuth.ts
similarity index 91%
rename from autogpt_platform/frontend/src/lib/supabase/hooks/useSupabase.ts
rename to autogpt_platform/frontend/src/lib/auth/hooks/useAuth.ts
index af0fc75914..58cc23859d 100644
--- a/autogpt_platform/frontend/src/lib/supabase/hooks/useSupabase.ts
+++ b/autogpt_platform/frontend/src/lib/auth/hooks/useAuth.ts
@@ -6,9 +6,9 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { useEffect } from "react";
import { useShallow } from "zustand/react/shallow";
import type { ServerLogoutOptions } from "../actions";
-import { useSupabaseStore } from "./useSupabaseStore";
+import { useAuthStore } from "./useAuthStore";
-export function useSupabase() {
+export function useAuth() {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
@@ -19,17 +19,15 @@ export function useSupabase() {
const {
user,
- supabase,
isUserLoading,
initialize,
setCurrentRequestContext,
logOut,
validateSession,
refreshSession,
- } = useSupabaseStore(
+ } = useAuthStore(
useShallow((state) => ({
user: state.user,
- supabase: state.supabase,
isUserLoading: state.isUserLoading,
initialize: state.initialize,
setCurrentRequestContext: state.setCurrentRequestContext,
@@ -66,7 +64,6 @@ export function useSupabase() {
return {
user,
- supabase,
isLoggedIn: Boolean(user),
isUserLoading,
logOut: handleLogout,
diff --git a/autogpt_platform/frontend/src/lib/supabase/hooks/useSupabaseStore.ts b/autogpt_platform/frontend/src/lib/auth/hooks/useAuthStore.ts
similarity index 94%
rename from autogpt_platform/frontend/src/lib/supabase/hooks/useSupabaseStore.ts
rename to autogpt_platform/frontend/src/lib/auth/hooks/useAuthStore.ts
index 9c73bb8049..b03861aa4f 100644
--- a/autogpt_platform/frontend/src/lib/supabase/hooks/useSupabaseStore.ts
+++ b/autogpt_platform/frontend/src/lib/auth/hooks/useAuthStore.ts
@@ -1,17 +1,16 @@
"use client";
import type BackendAPI from "@/lib/autogpt-server-api/client";
-import type { SupabaseClient, User } from "@supabase/supabase-js";
import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import { create } from "zustand";
import { serverLogout, type ServerLogoutOptions } from "../actions";
import {
broadcastLogout,
- setWebSocketDisconnectIntent,
setupSessionEventListeners,
+ setWebSocketDisconnectIntent,
} from "../helpers";
+import type { User } from "../types";
import {
- ensureSupabaseClient,
fetchUser,
handleStorageEvent as handleStorageEventHelper,
refreshSession as refreshSessionHelper,
@@ -36,9 +35,8 @@ interface ValidateParams {
router?: AppRouterInstance;
}
-interface SupabaseStoreState {
+interface AuthStoreState {
user: User | null;
- supabase: SupabaseClient | null;
isUserLoading: boolean;
isValidating: boolean;
hasLoadedUser: boolean;
@@ -56,7 +54,7 @@ interface SupabaseStoreState {
cleanup: () => void;
}
-export const useSupabaseStore = create<SupabaseStoreState>((set, get) => {
+export const useAuthStore = create<AuthStoreState>((set, get) => {
function setCurrentRequestContext(params: InitializeParams): void {
const state = get();
if (
@@ -76,11 +74,6 @@ export const useSupabaseStore = create<SupabaseStoreState>((set, get) => {
async function initialize(params: InitializeParams): Promise<void> {
setCurrentRequestContext(params);
- const supabaseClient = ensureSupabaseClient();
- if (supabaseClient !== get().supabase) {
- set({ supabase: supabaseClient });
- }
-
let initializationPromise = get().initializationPromise;
if (!initializationPromise) {
@@ -282,7 +275,6 @@ export const useSupabaseStore = create<SupabaseStoreState>((set, get) => {
return {
user: null,
- supabase: null,
isUserLoading: true,
isValidating: false,
hasLoadedUser: false,
diff --git a/autogpt_platform/frontend/src/lib/auth/legacy-cookies.ts b/autogpt_platform/frontend/src/lib/auth/legacy-cookies.ts
new file mode 100644
index 0000000000..abdbdb3171
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/legacy-cookies.ts
@@ -0,0 +1,20 @@
+/**
+ * Whether the platform may consume (clear) a caller's legacy Supabase cookies.
+ *
+ * Clearing them is what stops the middleware redirecting to the bridge
+ * forever, so the bridge clears on every path that reaches a verdict — but
+ * not before it is capable of reaching one. Without `SUPABASE_JWT_SECRET`
+ * verification can only fail, and clearing first would turn a missing env var
+ * into permanent, unrecoverable session loss for every migrating user: the
+ * cookie would be gone before anyone noticed the misconfiguration.
+ *
+ * The middleware gates on the same check before redirecting to the bridge at
+ * all — with no secret, the bridge would bounce straight back to /login with
+ * the cookies intact and the pair would loop forever. Shared module (with no
+ * server-only imports) so the edge middleware and the bridge can't drift.
+ */
+export function canConsumeLegacyCookies(
+ secret: string | undefined = process.env.SUPABASE_JWT_SECRET,
+): boolean {
+ return Boolean(secret);
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/middleware.ts b/autogpt_platform/frontend/src/lib/auth/middleware.ts
new file mode 100644
index 0000000000..c79aa036b6
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/middleware.ts
@@ -0,0 +1,105 @@
+import { getCookieCache, getSessionCookie } from "better-auth/cookies";
+import { NextResponse, type NextRequest } from "next/server";
+import { isAdminPage, isProtectedPage } from "./helpers";
+import { canConsumeLegacyCookies } from "./legacy-cookies";
+
+const SUPABASE_AUTH_COOKIE = /^sb-.+-auth-token(\.\d+)?$/;
+
+function hasLegacySupabaseSession(request: NextRequest): boolean {
+ return request.cookies
+ .getAll()
+ .some(({ name }) => SUPABASE_AUTH_COOKIE.test(name));
+}
+
+async function getSessionUserRole(
+ request: NextRequest,
+): Promise<string | null> {
+ // Fast path: the signed cookie cache carries the user without a DB hit.
+ try {
+ const cached = await getCookieCache(request, {
+ secret: process.env.BETTER_AUTH_SECRET,
+ });
+ if (cached?.user) {
+ return (cached.user as { role?: string }).role ?? null;
+ }
+ } catch {
+ // fall through to the full session fetch
+ }
+
+ try {
+ // Bounded so a stalled session lookup can't hang navigation. On any error
+ // (including this timeout) we fall through to null = "not admin", the safe
+ // default. Edge runtime here has no pg access, so this stays an HTTP call
+ // rather than the in-process auth API used elsewhere.
+ const response = await fetch(
+ new URL("/api/auth/get-session", request.url),
+ {
+ headers: { cookie: request.headers.get("cookie") || "" },
+ signal: AbortSignal.timeout(3000),
+ },
+ );
+ if (!response.ok) return null;
+ const session = await response.json();
+ return session?.user?.role ?? null;
+ } catch {
+ return null;
+ }
+}
+
+/**
+ * Route-protection middleware.
+ *
+ * Follows the Better Auth guidance for Next.js: the middleware only does an
+ * optimistic cookie-presence check for protected pages; real session
+ * validation happens in route handlers and server components. Admin pages
+ * additionally resolve the user's role (cookie cache first, then a session
+ * fetch).
+ */
+export async function authMiddleware(request: NextRequest) {
+ const url = request.nextUrl.clone();
+ const pathname = request.nextUrl.pathname;
+
+ // API routes authenticate themselves.
+ if (pathname.startsWith("/api/")) {
+ return NextResponse.next();
+ }
+
+ const sessionCookie = getSessionCookie(request);
+
+ // A logged-in Supabase user from before the auth migration: upgrade their
+ // legacy session into a Better Auth session. The bridge endpoint clears the
+ // Supabase cookies either way, so this runs at most once per browser.
+ // Gated on the bridge actually being able to consume the cookies — without
+ // SUPABASE_JWT_SECRET it bounces to /login with the cookies intact, and
+ // this redirect would send them right back: an infinite loop. With the
+ // secret unset the cookies are simply ignored (kept for a later bridge)
+ // and the user takes the normal login path.
+ if (
+ !sessionCookie &&
+ hasLegacySupabaseSession(request) &&
+ canConsumeLegacyCookies()
+ ) {
+ const next = encodeURIComponent(url.pathname + url.search);
+ url.pathname = "/api/auth/supabase-bridge";
+ url.search = `?next=${next}`;
+ return NextResponse.redirect(url);
+ }
+
+ if (!sessionCookie && (isProtectedPage(pathname) || isAdminPage(pathname))) {
+ const currentDest = url.pathname + url.search;
+ url.pathname = "/login";
+ url.search = `?next=${encodeURIComponent(currentDest)}`;
+ return NextResponse.redirect(url);
+ }
+
+ if (sessionCookie && isAdminPage(pathname)) {
+ const role = await getSessionUserRole(request);
+ if (role !== "admin") {
+ url.pathname = "/";
+ url.search = "";
+ return NextResponse.redirect(url);
+ }
+ }
+
+ return NextResponse.next();
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerAuthToken.test.ts b/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerAuthToken.test.ts
new file mode 100644
index 0000000000..96cdefbd30
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerAuthToken.test.ts
@@ -0,0 +1,132 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const getTokenMock = vi.fn();
+const cookiesMock = vi.fn();
+const headersMock = vi.fn();
+
+// Replaces the real auth instance so the module never pulls in `pg`, and so we
+// can assert the in-process token mint instead of the old HTTP self-fetch.
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ getToken: (...args: unknown[]) => getTokenMock(...args),
+ },
+ },
+}));
+
+vi.mock("next/headers", () => ({
+ cookies: () => cookiesMock(),
+ headers: () => headersMock(),
+}));
+
+function makeJwt(expSecondsFromNow: number): string {
+ const payload = Buffer.from(
+ JSON.stringify({ exp: Math.floor(Date.now() / 1000) + expSecondsFromNow }),
+ ).toString("base64url");
+ return `header.${payload}.signature`;
+}
+
+function cookieStore(cookies: { name: string; value: string }[]) {
+ return { getAll: () => cookies };
+}
+
+// Fresh module per test for isolation. React's cache() wrapper is shimmed to
+// identity in the global vitest setup, so per-request memoization is inert
+// here — every call really does re-mint.
+async function importModule() {
+ vi.resetModules();
+ return await import("../getServerAuthToken");
+}
+
+beforeEach(() => {
+ getTokenMock.mockReset();
+ cookiesMock.mockReset().mockResolvedValue(cookieStore([]));
+ headersMock.mockReset().mockResolvedValue(new Headers());
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("getServerAuthToken", () => {
+ it("returns null without minting a token when there is no Better Auth session cookie", async () => {
+ cookiesMock.mockResolvedValue(
+ cookieStore([{ name: "unrelated-cookie", value: "abc" }]),
+ );
+ const { getServerAuthToken } = await importModule();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ expect(getTokenMock).not.toHaveBeenCalled();
+ });
+
+ it("re-mints on every call rather than caching across requests", async () => {
+ // A cross-request cache keyed on the session cookie would hand back a token
+ // without re-checking the session, so a stolen cookie would keep working
+ // after logout or revokeSessionsOnPasswordReset deleted the session row —
+ // the backend only verifies the signature, never session existence.
+ // Re-minting is what makes revocation actually take effect.
+ const jwt = makeJwt(3600);
+ cookiesMock.mockResolvedValue(
+ cookieStore([
+ { name: "better-auth.session_token", value: "session-fresh" },
+ ]),
+ );
+ getTokenMock.mockResolvedValue({ token: jwt });
+ const { getServerAuthToken } = await importModule();
+
+ const first = await getServerAuthToken();
+ const second = await getServerAuthToken();
+
+ expect(first).toBe(jwt);
+ expect(second).toBe(jwt);
+ expect(getTokenMock).toHaveBeenCalledTimes(2);
+ expect(getTokenMock).toHaveBeenCalledWith({ headers: expect.any(Headers) });
+ });
+
+ it("recognizes the __Secure-prefixed session cookie", async () => {
+ const jwt = makeJwt(3600);
+ cookiesMock.mockResolvedValue(
+ cookieStore([
+ { name: "__Secure-better-auth.session_token", value: "session-secure" },
+ ]),
+ );
+ getTokenMock.mockResolvedValue({ token: jwt });
+ const { getServerAuthToken } = await importModule();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBe(jwt);
+ expect(getTokenMock).toHaveBeenCalledTimes(1);
+ });
+
+ it("returns null when auth.api.getToken yields no token", async () => {
+ cookiesMock.mockResolvedValue(
+ cookieStore([
+ { name: "better-auth.session_token", value: "session-empty" },
+ ]),
+ );
+ getTokenMock.mockResolvedValue({ token: undefined });
+ const { getServerAuthToken } = await importModule();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ });
+
+ it("returns null instead of throwing when the token mint fails", async () => {
+ cookiesMock.mockResolvedValue(
+ cookieStore([
+ { name: "better-auth.session_token", value: "session-error" },
+ ]),
+ );
+ getTokenMock.mockRejectedValue(new Error("jwks unavailable"));
+ const { getServerAuthToken } = await importModule();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerUser.test.ts b/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerUser.test.ts
new file mode 100644
index 0000000000..37c6dd99ac
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/__tests__/getServerUser.test.ts
@@ -0,0 +1,66 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const getServerSessionMock = vi.fn();
+
+vi.mock("../getServerSession", () => ({
+ getServerSession: () => getServerSessionMock(),
+}));
+
+import { getServerUser } from "../getServerUser";
+
+beforeEach(() => {
+ getServerSessionMock.mockReset();
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+});
+
+describe("getServerUser", () => {
+ it("maps the session user and exposes the admin role", async () => {
+ getServerSessionMock.mockResolvedValue({
+ user: {
+ id: "admin-1",
+ email: "[email protected]",
+ name: "Admin",
+ role: "admin",
+ createdAt: new Date("2026-01-02T03:04:05.000Z"),
+ },
+ });
+
+ const result = await getServerUser();
+
+ expect(result.error).toBeNull();
+ expect(result.role).toBe("admin");
+ expect(result.user).toEqual({
+ id: "admin-1",
+ email: "[email protected]",
+ role: "admin",
+ created_at: "2026-01-02T03:04:05.000Z",
+ user_metadata: { name: "Admin", email: "[email protected]" },
+ });
+ });
+
+ it("returns an error when there is no session", async () => {
+ getServerSessionMock.mockResolvedValue(null);
+
+ const result = await getServerUser();
+
+ expect(result).toEqual({
+ user: null,
+ role: null,
+ error: "No user found in the response",
+ });
+ });
+
+ it("catches thrown errors into the error field", async () => {
+ getServerSessionMock.mockRejectedValue(new Error("db unavailable"));
+
+ const result = await getServerUser();
+
+ expect(result.user).toBeNull();
+ expect(result.role).toBeNull();
+ expect(result.error).toBe("Unexpected error: db unavailable");
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/server/__tests__/rollbackSession.test.ts b/autogpt_platform/frontend/src/lib/auth/server/__tests__/rollbackSession.test.ts
new file mode 100644
index 0000000000..6f84f13707
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/__tests__/rollbackSession.test.ts
@@ -0,0 +1,63 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const signOutMock = vi.fn();
+const cookieDeleteMock = vi.fn();
+let cookieJar: { name: string; value: string }[] = [];
+
+vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ signOut: (...args: unknown[]) => signOutMock(...args),
+ },
+ },
+}));
+
+vi.mock("next/headers", () => ({
+ cookies: vi.fn(async () => ({
+ getAll: () => cookieJar,
+ get: (name: string) => cookieJar.find((c) => c.name === name),
+ delete: (name: string) => cookieDeleteMock(name),
+ })),
+}));
+
+import { rollbackSession } from "../rollbackSession";
+
+beforeEach(() => {
+ signOutMock.mockReset().mockResolvedValue({ success: true });
+ cookieDeleteMock.mockReset();
+ cookieJar = [
+ { name: "better-auth.session_token", value: "tok.sig" },
+ { name: "better-auth.session_data", value: "cached" },
+ { name: "theme", value: "dark" },
+ ];
+});
+
+describe("rollbackSession", () => {
+ it("revokes the session using the pending cookie store, not request headers", async () => {
+ await rollbackSession();
+
+ expect(signOutMock).toHaveBeenCalledTimes(1);
+ const headers = signOutMock.mock.calls[0][0].headers as Headers;
+ expect(headers.get("cookie")).toContain(
+ "better-auth.session_token=tok.sig",
+ );
+ });
+
+ it("clears the session cookies but leaves unrelated cookies alone", async () => {
+ await rollbackSession();
+
+ expect(cookieDeleteMock).toHaveBeenCalledWith("better-auth.session_token");
+ expect(cookieDeleteMock).toHaveBeenCalledWith("better-auth.session_data");
+ expect(cookieDeleteMock).not.toHaveBeenCalledWith("theme");
+ });
+
+ it("swallows sign-out failures so the caller's error reporting wins", async () => {
+ signOutMock.mockRejectedValue(new Error("session backend down"));
+ const errorSpy = vi
+ .spyOn(console, "error")
+ .mockImplementation(() => undefined);
+
+ await expect(rollbackSession()).resolves.toBeUndefined();
+ expect(errorSpy).toHaveBeenCalled();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/server/getServerAuthToken.ts b/autogpt_platform/frontend/src/lib/auth/server/getServerAuthToken.ts
new file mode 100644
index 0000000000..6c2ad825c0
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/getServerAuthToken.ts
@@ -0,0 +1,46 @@
+import { auth } from "@/lib/auth/auth";
+import { cookies, headers } from "next/headers";
+import { cache } from "react";
+
+/**
+ * Mints a backend-API JWT for the current request's session by calling the
+ * Better Auth server instance IN-PROCESS via `auth.api.getToken`. The Python
+ * backend validates the JWT against /api/auth/jwks.
+ *
+ * This deliberately replaces the previous HTTP self-fetch to
+ * `/api/auth/token`: under constrained preview concurrency that fan-out could
+ * deadlock (every worker awaiting another worker's token request), which hung
+ * the Copilot page forever. An in-process call has no such dependency.
+ *
+ * Only React's `cache()` memoizes it — deliberately per-request, not a
+ * cross-request Map keyed on the session cookie. Such a cache returns a token
+ * without re-checking the session, which silently outlives revocation: a stolen
+ * cookie would keep minting backend access for the rest of the JWT's lifetime
+ * even after logout or `revokeSessionsOnPasswordReset` deleted the session row
+ * (the backend only verifies the signature, never session existence). Minting
+ * is in-process, so re-checking every request is cheap.
+ *
+ * Server-only: it statically imports `auth`, which pulls in `pg`, so it must
+ * never reach the browser bundle. Client-graph modules cannot import it at all
+ * — not even dynamically, since webpack resolves dynamic imports in the same
+ * layer; they keep the self-fetching variant in autogpt-server-api/helpers.ts.
+ */
+export const getServerAuthToken = cache(async (): Promise<string | null> => {
+ try {
+ const cookieStore = await cookies();
+ const sessionCookie = cookieStore
+ .getAll()
+ .find(
+ ({ name }) =>
+ name === "better-auth.session_token" ||
+ name === "__Secure-better-auth.session_token",
+ );
+ if (!sessionCookie) return null;
+
+ const { token } = await auth.api.getToken({ headers: await headers() });
+ return token ?? null;
+ } catch (error) {
+ console.error("Failed to get auth token:", error);
+ return null;
+ }
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/server/getServerSession.ts b/autogpt_platform/frontend/src/lib/auth/server/getServerSession.ts
new file mode 100644
index 0000000000..bc2b94eff6
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/getServerSession.ts
@@ -0,0 +1,16 @@
+import { auth } from "@/lib/auth/auth";
+import { headers } from "next/headers";
+import { cache } from "react";
+
+/**
+ * Reads the Better Auth session for the current request. React-cached so
+ * repeated calls within one request hit the DB (or cookie cache) once.
+ */
+export const getServerSession = cache(async () => {
+ try {
+ return await auth.api.getSession({ headers: await headers() });
+ } catch (error) {
+ console.error("Failed to read auth session:", error);
+ return null;
+ }
+});
diff --git a/autogpt_platform/frontend/src/lib/auth/server/getServerUser.ts b/autogpt_platform/frontend/src/lib/auth/server/getServerUser.ts
new file mode 100644
index 0000000000..0d84053722
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/getServerUser.ts
@@ -0,0 +1,26 @@
+import { mapSessionUser, type User } from "@/lib/auth/types";
+import { getServerSession } from "./getServerSession";
+
+export async function getServerUser(): Promise<{
+ user: User | null;
+ role: string | null;
+ error: string | null;
+}> {
+ try {
+ const session = await getServerSession();
+
+ if (!session?.user) {
+ return { user: null, role: null, error: "No user found in the response" };
+ }
+
+ const user = mapSessionUser(session.user);
+ return { user, role: user.role || null, error: null };
+ } catch (error) {
+ console.error("Unexpected error in getServerUser:", error);
+ return {
+ user: null,
+ role: null,
+ error: `Unexpected error: ${(error as Error).message}`,
+ };
+ }
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/server/rollbackSession.ts b/autogpt_platform/frontend/src/lib/auth/server/rollbackSession.ts
new file mode 100644
index 0000000000..30dd38431b
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/server/rollbackSession.ts
@@ -0,0 +1,37 @@
+import { auth } from "@/lib/auth/auth";
+import { cookies } from "next/headers";
+
+/**
+ * Revokes the session created earlier in the SAME server action (e.g. when
+ * platform user provisioning fails right after sign-in/sign-up, the UI
+ * reports failure — an authenticated cookie must not linger behind it).
+ *
+ * Reads cookies via `cookies()` rather than the request headers because the
+ * just-set session cookie only exists in the pending response cookie store.
+ * Best-effort: rollback failures are swallowed so the caller's own error
+ * reporting wins.
+ */
+export async function rollbackSession(): Promise<void> {
+ try {
+ const cookieStore = await cookies();
+ const cookieHeader = cookieStore
+ .getAll()
+ .map(({ name, value }) => `${name}=${encodeURIComponent(value)}`)
+ .join("; ");
+
+ await auth.api.signOut({
+ headers: new Headers({ cookie: cookieHeader }),
+ });
+
+ for (const name of [
+ "better-auth.session_token",
+ "__Secure-better-auth.session_token",
+ "better-auth.session_data",
+ "__Secure-better-auth.session_data",
+ ]) {
+ if (cookieStore.get(name)) cookieStore.delete(name);
+ }
+ } catch (error) {
+ console.error("Failed to roll back auth session:", error);
+ }
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/service-token.ts b/autogpt_platform/frontend/src/lib/auth/service-token.ts
new file mode 100644
index 0000000000..4f3b2a0e6c
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/service-token.ts
@@ -0,0 +1,48 @@
+import { signJWT } from "better-auth/plugins/jwt";
+
+export const SERVICE_TOKEN_AUDIENCE = "autogpt-platform-backend";
+export const FRONTEND_SERVICE_SUBJECT = "service:frontend";
+
+/**
+ * Algorithm of the Better Auth JWKS keypair, shared with the jwt plugin config
+ * in auth.ts so the two can never drift. It lives here rather than in auth.ts
+ * because this module must not statically import ./auth (see below).
+ */
+export const JWKS_ALG = "ES256" as const;
+
+type SignJWTContext = Parameters<typeof signJWT>[0];
+
+/**
+ * Mints a short-lived JWT proving "this request came from our frontend" for
+ * backend endpoints that run before any user session exists (e.g. auth
+ * emails). Signed with the same Better Auth JWKS key the backend already
+ * trusts for user tokens (JWT_JWKS_URL), but with a distinct audience and
+ * subject so user and service tokens can never stand in for each other.
+ */
+export async function mintServiceToken(scope: string) {
+ // Dynamic import: auth.ts (via email.ts) imports this module, so a static
+ // import back to ./auth would create an init cycle.
+ const { auth } = await import("./auth");
+ const context = await auth.$context;
+ const nowSeconds = Math.floor(Date.now() / 1000);
+
+ // signJWT only ever dereferences ctx.context; the `as unknown` is required
+ // because its declared type demands request-scoped fields (request, body,
+ // headers) that don't exist before a session does.
+ return signJWT({ context } as unknown as SignJWTContext, {
+ options: {
+ // Must match the jwt plugin config in auth.ts: on a fresh install with
+ // no JWKS row yet (e.g. first signup email before any login), signJWT
+ // creates the key, and the alg chosen here becomes the key user tokens
+ // sign with too.
+ jwks: { keyPairConfig: { alg: JWKS_ALG } },
+ },
+ payload: {
+ sub: FRONTEND_SERVICE_SUBJECT,
+ aud: SERVICE_TOKEN_AUDIENCE,
+ scope,
+ iat: nowSeconds,
+ exp: nowSeconds + 60,
+ },
+ });
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/signup-gate.ts b/autogpt_platform/frontend/src/lib/auth/signup-gate.ts
new file mode 100644
index 0000000000..797bf181ff
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/signup-gate.ts
@@ -0,0 +1,84 @@
+/**
+ * Environment-driven signup gating.
+ *
+ * Replaces the old DB-level allowlist (a Postgres trigger on `auth.users`,
+ * cloud-infra-only). Going forward, signup gating is pure env config so each
+ * environment controls it independently with no schema/data:
+ *
+ * AUTH_ALLOW_NEW_ACCOUNTS "false" blocks ALL new signups. Default: open.
+ * AUTH_SIGNUP_ALLOWLIST comma-separated allowed emails and `@domains`.
+ * Empty/unset = no allowlist (open). When set,
+ * only matching emails may create an account.
+ *
+ * Prod leaves both unset → open signup. Dev/preview sets AUTH_SIGNUP_ALLOWLIST
+ * so randoms can't sign up on a public preview URL.
+ *
+ * Enforced in auth.ts via `databaseHooks.user.create.before`, which fires for
+ * BOTH email/password signup and a first OAuth sign-in (both create a user).
+ * Existing users are unaffected — the hook only runs on user *creation*, and
+ * the one-time data migration inserts via raw SQL, bypassing it.
+ *
+ * Migrating an existing `allowed_users` table to the env var:
+ * psql -tAc "select string_agg(email, ',') from allowed_users" \
+ * → paste into AUTH_SIGNUP_ALLOWLIST.
+ */
+
+export interface SignupGateConfig {
+ allowNewAccounts: boolean;
+ allowlist: string[];
+}
+
+const DISABLED_MESSAGE =
+ "New account registration is not allowed at this time.";
+const NOT_ALLOWLISTED_MESSAGE =
+ "This email address is not allowed to register. Please contact support for assistance.";
+
+export function parseAllowlist(raw: string | undefined | null): string[] {
+ if (!raw) return [];
+ return raw
+ .split(",")
+ .map((entry) => entry.trim().toLowerCase())
+ .filter(Boolean);
+}
+
+export function readSignupGateConfig(
+ env: Record<string, string | undefined> = process.env,
+): SignupGateConfig {
+ return {
+ // Only an explicit "false" disables; anything else (incl. unset) is open.
+ allowNewAccounts: env.AUTH_ALLOW_NEW_ACCOUNTS !== "false",
+ allowlist: parseAllowlist(env.AUTH_SIGNUP_ALLOWLIST),
+ };
+}
+
+export interface SignupDecision {
+ allowed: boolean;
+ /** Human message; phrased so the frontend `isWaitlistError()` catches it. */
+ reason?: string;
+}
+
+export function isSignupAllowed(
+ email: string,
+ config: SignupGateConfig,
+): SignupDecision {
+ if (!config.allowNewAccounts) {
+ return { allowed: false, reason: DISABLED_MESSAGE };
+ }
+
+ // No allowlist configured → open (the prod default).
+ if (config.allowlist.length === 0) {
+ return { allowed: true };
+ }
+
+ const normalized = email.trim().toLowerCase();
+ const atIndex = normalized.lastIndexOf("@");
+ const domain = atIndex >= 0 ? normalized.slice(atIndex) : "";
+
+ const matches = config.allowlist.some((entry) =>
+ entry.startsWith("@") ? entry === domain : entry === normalized,
+ );
+
+ return matches
+ ? { allowed: true }
+ : { allowed: false, reason: NOT_ALLOWLISTED_MESSAGE };
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/supabase-bridge.ts b/autogpt_platform/frontend/src/lib/auth/supabase-bridge.ts
new file mode 100644
index 0000000000..4904780b6c
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/supabase-bridge.ts
@@ -0,0 +1,197 @@
+import { sanitizeAuthNext } from "@/lib/auth-redirect";
+import { canConsumeLegacyCookies } from "@/lib/auth/legacy-cookies";
+import type { BetterAuthPlugin } from "better-auth";
+import { createAuthEndpoint } from "better-auth/api";
+import { setSessionCookie } from "better-auth/cookies";
+import { jwtVerify } from "jose";
+
+const DEFAULT_MAX_TOKEN_AGE_DAYS = 30;
+
+/**
+ * Picks the Supabase auth-token cookies (including chunked `.0`/`.1` parts)
+ * out of a Cookie header and reassembles the stored session JSON.
+ */
+export function parseSupabaseSessionCookie(cookieHeader: string): {
+ accessToken: string | null;
+ cookieNames: string[];
+} {
+ const cookies = cookieHeader
+ .split(";")
+ .map((part) => part.trim())
+ .filter(Boolean)
+ .map((part) => {
+ const eq = part.indexOf("=");
+ return { name: part.slice(0, eq), value: part.slice(eq + 1) };
+ });
+
+ // Order chunks by their numeric suffix (base cookie = -1), so `.2` precedes
+ // `.10` — a lexicographic sort would reassemble the chunks out of order once
+ // a session spans more than ten cookies.
+ const chunkIndex = (name: string): number => {
+ const dot = name.lastIndexOf(".");
+ const suffix = dot === -1 ? "" : name.slice(dot + 1);
+ return /^\d+$/.test(suffix) ? Number(suffix) : -1;
+ };
+ const authCookies = cookies
+ .filter(({ name }) => /^sb-.+-auth-token(\.\d+)?$/.test(name))
+ .sort((a, b) => chunkIndex(a.name) - chunkIndex(b.name));
+
+ if (authCookies.length === 0) {
+ return { accessToken: null, cookieNames: [] };
+ }
+
+ const cookieNames = authCookies.map(({ name }) => name);
+ const joined = authCookies.map(({ value }) => value).join("");
+ let raw: string;
+ try {
+ raw = decodeURIComponent(joined);
+ } catch {
+ // Malformed percent-encoding in the cookie — treat as no bridgeable session
+ // rather than throwing an uncaught URIError.
+ return { accessToken: null, cookieNames };
+ }
+
+ if (raw.startsWith("base64-")) {
+ try {
+ raw = Buffer.from(raw.slice("base64-".length), "base64").toString(
+ "utf-8",
+ );
+ } catch {
+ return { accessToken: null, cookieNames };
+ }
+ }
+
+ try {
+ const session = JSON.parse(raw);
+ const accessToken = session?.access_token;
+ return {
+ accessToken: typeof accessToken === "string" ? accessToken : null,
+ cookieNames,
+ };
+ } catch {
+ return { accessToken: null, cookieNames };
+ }
+}
+
+/**
+ * Verifies a legacy Supabase (GoTrue) HS256 access token. Expired tokens are
+ * accepted within the configured window: the signature still proves the
+ * cookie came from a real GoTrue login, and GoTrue sessions outlived their
+ * 1-hour access tokens via refresh tokens that no longer have an issuer to
+ * talk to. Without this tolerance only users active in the final hour before
+ * cutover would keep their sessions.
+ */
+export async function verifyLegacyToken(token: string): Promise<string | null> {
+ const secret = process.env.SUPABASE_JWT_SECRET;
+ if (!secret) return null;
+
+ // Parse the raw env alone (not `|| DEFAULT`): a non-numeric value would make
+ // Number() -> NaN, and clockTolerance: NaN makes jose's expiry comparison
+ // always-false — i.e. ANY expired legacy token would be accepted (fail-open).
+ // Fall back to the default on NaN / non-positive so a config typo can't
+ // silently disable the age limit.
+ const parsedMaxAgeDays = Number(
+ process.env.SUPABASE_BRIDGE_MAX_TOKEN_AGE_DAYS,
+ );
+ // Accept 0 (an explicit "zero tolerance" that rejects any expired token);
+ // only NaN / negative falls back to the default.
+ const maxAgeDays =
+ Number.isFinite(parsedMaxAgeDays) && parsedMaxAgeDays >= 0
+ ? parsedMaxAgeDays
+ : DEFAULT_MAX_TOKEN_AGE_DAYS;
+
+ try {
+ const { payload } = await jwtVerify(
+ token,
+ new TextEncoder().encode(secret),
+ {
+ algorithms: ["HS256"],
+ audience: "authenticated",
+ clockTolerance: maxAgeDays * 24 * 60 * 60,
+ },
+ );
+ return typeof payload.sub === "string" ? payload.sub : null;
+ } catch {
+ return null;
+ }
+}
+
+/**
+ * Better Auth plugin that silently upgrades a legacy Supabase session into a
+ * Better Auth session, so existing logged-in users don't get kicked to the
+ * login page by the auth migration.
+ *
+ * GET /api/auth/supabase-bridge?next=<path> — called by the middleware when a
+ * request carries Supabase auth cookies but no Better Auth session cookie.
+ * Either way the legacy cookies are cleared so the bridge runs at most once.
+ */
+
+export function supabaseBridge() {
+ return {
+ id: "supabase-bridge",
+ endpoints: {
+ bridgeSupabaseSession: createAuthEndpoint(
+ "/supabase-bridge",
+ { method: "GET" },
+ async (ctx) => {
+ // Same guard as the auth pages — one implementation, so a bypass
+ // can't be fixed in one place and left open in the other.
+ const next = sanitizeAuthNext(ctx.query?.next) ?? "/";
+ const loginUrl = `${ctx.context.options.baseURL || ""}/login?next=${encodeURIComponent(next)}`;
+ const nextUrl = `${ctx.context.options.baseURL || ""}${next}`;
+
+ const cookieHeader = ctx.headers?.get("cookie") || "";
+ const { accessToken, cookieNames } =
+ parseSupabaseSessionCookie(cookieHeader);
+
+ if (!canConsumeLegacyCookies()) {
+ // Leave the cookies intact: once the secret is configured, the
+ // user's next request bridges normally instead of being stranded.
+ throw ctx.redirect(loginUrl);
+ }
+
+ for (const name of cookieNames) {
+ ctx.setCookie(name, "", { path: "/", maxAge: 0 });
+ }
+
+ if (!accessToken) {
+ throw ctx.redirect(loginUrl);
+ }
+
+ const userId = await verifyLegacyToken(accessToken);
+ if (!userId) {
+ throw ctx.redirect(loginUrl);
+ }
+
+ const user = await ctx.context.internalAdapter.findUserById(userId);
+ if (!user) {
+ throw ctx.redirect(loginUrl);
+ }
+
+ // Don't let a banned account with a still-valid legacy cookie mint a
+ // fresh Better Auth session — that would bypass the admin plugin's
+ // sign-in ban gate. The bridge window can outlast a ban, so enforce
+ // it here too even though no users are banned today.
+ const bannedUser = user as {
+ banned?: boolean | null;
+ banExpires?: Date | string | null;
+ };
+ const banActive =
+ bannedUser.banned === true &&
+ (!bannedUser.banExpires ||
+ new Date(bannedUser.banExpires) > new Date());
+ if (banActive) {
+ throw ctx.redirect(loginUrl);
+ }
+
+ const session = await ctx.context.internalAdapter.createSession(
+ user.id,
+ );
+ await setSessionCookie(ctx, { session, user });
+
+ throw ctx.redirect(nextUrl);
+ },
+ ),
+ },
+ } satisfies BetterAuthPlugin;
+}
diff --git a/autogpt_platform/frontend/src/lib/auth/types.ts b/autogpt_platform/frontend/src/lib/auth/types.ts
new file mode 100644
index 0000000000..9b66362323
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/auth/types.ts
@@ -0,0 +1,50 @@
+/**
+ * Session user shape exposed to the app.
+ *
+ * Field names intentionally mirror the Supabase `User` object
+ * (`created_at`, `user_metadata`) so the ~50 existing consumers of
+ * `useAuth().user` / `getServerUser()` keep working unchanged.
+ */
+export interface User {
+ id: string;
+ email: string;
+ // Snake_case to match the Supabase shape. Lets the change-email UI branch:
+ // verified users get a confirmation link to their current address, unverified
+ // users have the change applied immediately (see lib/auth/auth.ts changeEmail).
+ email_verified?: boolean;
+ role?: string;
+ created_at?: string;
+ user_metadata: {
+ name?: string;
+ email?: string;
+ preferred_name?: string;
+ };
+}
+
+interface SessionUserLike {
+ id: string;
+ email: string;
+ emailVerified?: boolean | null;
+ name?: string | null;
+ role?: string | null;
+ preferredName?: string | null;
+ createdAt?: Date | string;
+}
+
+export function mapSessionUser(user: SessionUserLike): User {
+ return {
+ id: user.id,
+ email: user.email,
+ email_verified: user.emailVerified ?? undefined,
+ role: user.role === "admin" ? "admin" : "authenticated",
+ created_at:
+ user.createdAt instanceof Date
+ ? user.createdAt.toISOString()
+ : user.createdAt,
+ user_metadata: {
+ name: user.name ?? undefined,
+ email: user.email,
+ preferred_name: user.preferredName ?? undefined,
+ },
+ };
+}
diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/getServerAuthToken.test.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/getServerAuthToken.test.ts
new file mode 100644
index 0000000000..b883a139f4
--- /dev/null
+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/getServerAuthToken.test.ts
@@ -0,0 +1,179 @@
+import { createRequire } from "node:module";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const isClientSideMock = vi.fn(() => false);
+const getAllCookiesMock = vi.fn<() => { name: string; value: string }[]>(
+ () => [],
+);
+
+vi.mock("@/services/environment", () => ({
+ environment: {
+ isClientSide: () => isClientSideMock(),
+ isServerSide: () => !isClientSideMock(),
+ getAGPTServerApiUrl: () => "http://localhost:8006/api",
+ },
+}));
+
+// getServerAuthToken reads cookies through a lazy `require("next/headers")`,
+// which resolves via Node's CJS loader and therefore bypasses vi.mock. Spy on
+// the shared CJS module instance instead so the production require sees the
+// stubbed cookie store.
+const cjsRequire = createRequire(import.meta.url);
+const nextHeadersCjs = cjsRequire(
+ "next/headers",
+) as typeof import("next/headers");
+type CookieStore = Awaited<ReturnType<typeof nextHeadersCjs.cookies>>;
+
+const fetchMock = vi.fn();
+
+function makeJwt(expSecondsFromNow: number): string {
+ const payload = Buffer.from(
+ JSON.stringify({ exp: Math.floor(Date.now() / 1000) + expSecondsFromNow }),
+ ).toString("base64url");
+ return `header.${payload}.signature`;
+}
+
+// Each test imports a fresh copy of the module to stay isolated. React's
+// cache() wrapper is shimmed to identity in the global vitest setup, so
+// per-request memoization is inert here — every call really does re-mint.
+async function importGetServerAuthToken() {
+ vi.resetModules();
+ const helpers = await import("../helpers");
+ return helpers.getServerAuthToken;
+}
+
+beforeEach(() => {
+ isClientSideMock.mockReset().mockReturnValue(false);
+ getAllCookiesMock.mockReset().mockReturnValue([]);
+ fetchMock.mockReset();
+ vi.spyOn(nextHeadersCjs, "cookies").mockImplementation(
+ async () => ({ getAll: () => getAllCookiesMock() }) as CookieStore,
+ );
+ vi.stubGlobal("fetch", fetchMock);
+ vi.stubEnv("BETTER_AUTH_URL", "http://auth.internal:3000");
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+ vi.unstubAllEnvs();
+ vi.restoreAllMocks();
+});
+
+describe("getServerAuthToken", () => {
+ it("returns null on the client side without reading cookies or fetching", async () => {
+ isClientSideMock.mockReturnValue(true);
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ expect(getAllCookiesMock).not.toHaveBeenCalled();
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it("returns null without fetching when there is no Better Auth session cookie", async () => {
+ getAllCookiesMock.mockReturnValue([
+ { name: "unrelated-cookie", value: "abc" },
+ ]);
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it("re-mints on every call rather than caching across requests", async () => {
+ // A cross-request cache would return a token without re-checking the
+ // session, outliving logout / password-reset revocation. Going back to
+ // /api/auth/token each time is what re-validates it.
+ const jwt = makeJwt(3600);
+ getAllCookiesMock.mockReturnValue([
+ { name: "better-auth.session_token", value: "session-fresh" },
+ { name: "other", value: "with spaces" },
+ ]);
+ // A fresh Response per call — a body can only be consumed once, so a shared
+ // instance would make the second call look like a failure.
+ fetchMock.mockImplementation(
+ async () => new Response(JSON.stringify({ token: jwt }), { status: 200 }),
+ );
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const first = await getServerAuthToken();
+ const second = await getServerAuthToken();
+
+ expect(first).toBe(jwt);
+ expect(second).toBe(jwt);
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ expect(fetchMock).toHaveBeenCalledWith(
+ "http://auth.internal:3000/api/auth/token",
+ {
+ headers: {
+ cookie:
+ "better-auth.session_token=session-fresh; other=with%20spaces",
+ },
+ cache: "no-store",
+ // Bounded on purpose: this is a request from the Next server to itself,
+ // so an unbounded wait can deadlock a worker instead of erroring.
+ signal: expect.any(AbortSignal),
+ },
+ );
+ });
+
+ it("recognizes the __Secure-prefixed session cookie", async () => {
+ const jwt = makeJwt(3600);
+ getAllCookiesMock.mockReturnValue([
+ { name: "__Secure-better-auth.session_token", value: "session-secure" },
+ ]);
+ fetchMock.mockResolvedValue(
+ new Response(JSON.stringify({ token: jwt }), { status: 200 }),
+ );
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBe(jwt);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
+
+ it("returns null when the token endpoint responds with a non-200 status", async () => {
+ getAllCookiesMock.mockReturnValue([
+ { name: "better-auth.session_token", value: "session-unauthorized" },
+ ]);
+ fetchMock.mockResolvedValue(
+ new Response(JSON.stringify({ error: "unauthorized" }), { status: 401 }),
+ );
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ });
+
+ it("returns null when the token endpoint responds without a token field", async () => {
+ getAllCookiesMock.mockReturnValue([
+ { name: "better-auth.session_token", value: "session-empty-body" },
+ ]);
+ fetchMock.mockResolvedValue(
+ new Response(JSON.stringify({}), { status: 200 }),
+ );
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ });
+
+ it("returns null instead of throwing when the token fetch fails", async () => {
+ getAllCookiesMock.mockReturnValue([
+ { name: "better-auth.session_token", value: "session-network-error" },
+ ]);
+ fetchMock.mockRejectedValue(new TypeError("fetch failed"));
+ const getServerAuthToken = await importGetServerAuthToken();
+
+ const token = await getServerAuthToken();
+
+ expect(token).toBeNull();
+ });
+});
diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/helpers.test.ts
index df60c5c114..dcaa0a7bf8 100644
--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/__tests__/helpers.test.ts
@@ -1,9 +1,5 @@
import { describe, expect, it, vi } from "vitest";
-vi.mock("@/lib/supabase/server/getServerSupabase", () => ({
- getServerSupabase: vi.fn(),
-}));
-
vi.mock("@/services/environment", () => ({
environment: {
isServerSide: vi.fn(() => true),
diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts
index dca6dfc06e..12ac65d9f5 100644
--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts
+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts
@@ -1,13 +1,10 @@
import { IMPERSONATION_HEADER_NAME } from "@/lib/constants";
+import { getWebSocketToken } from "@/lib/auth/actions";
import { ImpersonationState } from "@/lib/impersonation";
-import { getWebSocketToken } from "@/lib/supabase/actions";
-import { ensureSupabaseClient } from "@/lib/supabase/hooks/helpers";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
import { getDatafastAttribution } from "@/services/analytics/datafast-attribution";
import { environment } from "@/services/environment";
import { Key, storage } from "@/services/storage/local-storage";
import * as Sentry from "@sentry/nextjs";
-import type { SupabaseClient } from "@supabase/supabase-js";
import type {
AddUserCreditsResponse,
AnalyticsDetails,
@@ -114,17 +111,12 @@ export default class BackendAPI {
this.wsUrl = wsUrl;
}
- private async getSupabaseClient(): Promise<SupabaseClient | null> {
- return isClient ? ensureSupabaseClient() : await getServerSupabase();
- }
-
async isAuthenticated(): Promise<boolean> {
- const supabaseClient = await this.getSupabaseClient();
- if (!supabaseClient) return false;
- const {
- data: { session },
- } = await supabaseClient.auth.getSession();
- return session != null;
+ // getWebSocketToken is a server action, so this works from both the
+ // client (RPC) and the server (direct call); a token is only minted
+ // when a valid session exists.
+ const { token, error } = await getWebSocketToken();
+ return token != null && !error;
}
createUser(): Promise<User> {
@@ -730,7 +722,7 @@ export default class BackendAPI {
formData: FormData,
): Promise<string> {
// Dynamic import is required even for client-only functions because helpers.ts
- // has server-only imports (like getServerSupabase) at the top level. Static imports
+ // has server-only imports (like getBackendAuthToken) at the top level. Static imports
// would bundle server-only code into the client bundle, causing runtime errors.
const { buildClientUrl, handleFetchError } = await import("./helpers");
@@ -876,7 +868,7 @@ export default class BackendAPI {
payload?: Record<string, any>,
) {
// Dynamic import is required even for client-only functions because helpers.ts
- // has server-only imports (like getServerSupabase) at the top level. Static imports
+ // has server-only imports (like getBackendAuthToken) at the top level. Static imports
// would bundle server-only code into the client bundle, causing runtime errors.
const {
buildClientUrl,
diff --git a/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts b/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts
index e903ed5bea..3ad69a4ced 100644
--- a/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts
+++ b/autogpt_platform/frontend/src/lib/autogpt-server-api/helpers.ts
@@ -2,7 +2,6 @@ import {
API_KEY_HEADER_NAME,
IMPERSONATION_HEADER_NAME,
} from "@/lib/constants";
-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";
import { environment } from "@/services/environment";
import { Key, storage } from "@/services/storage/local-storage";
import { cache } from "react";
@@ -111,15 +110,73 @@ export async function handleFetchError(response: Response): Promise<ApiError> {
);
}
+/**
+ * Mints a backend-API JWT for the current request's session by calling the
+ * Better Auth token endpoint on this same server.
+ * The Python backend validates the JWT against /api/auth/jwks.
+ *
+ * Deliberately uses an HTTP call instead of importing the Better Auth server
+ * instance: this module is part of the client component graph (via the orval
+ * mutator), where transitively importing pg breaks the browser
+ * bundle. Cookies are read via next/headers `cookies()` (lazily required, as
+ * the previous Supabase client did here) so that a session cookie set
+ * earlier in the SAME server action — e.g. right after sign-in — is visible
+ * immediately, not just on the next request.
+ *
+ * Only React's `cache()` memoizes it — deliberately per-request, not a
+ * cross-request Map keyed on the session cookie. Such a cache hands back a
+ * token without re-checking the session, so it silently outlives revocation:
+ * a stolen cookie would keep minting backend access for the rest of the JWT's
+ * lifetime after logout or `revokeSessionsOnPasswordReset` deleted the session
+ * row, since the backend only verifies the signature and never session
+ * existence. Going back to /api/auth/token each render re-validates it.
+ */
export const getServerAuthToken = cache(async (): Promise<string | null> => {
- const supabase = await getServerSupabase();
+ if (environment.isClientSide()) {
+ // Browser requests go through /api/proxy, which attaches the token
+ // server-side; there is no client-side token.
+ return null;
+ }
try {
- const {
- data: { session },
- } = await supabase.auth.getSession();
-
- return session?.access_token ?? null;
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const headersModule = require("next/headers");
+ const nextHeaders = headersModule as typeof import("next/headers");
+ const cookieStore = await nextHeaders.cookies();
+
+ const sessionCookie = cookieStore
+ .getAll()
+ .find(
+ ({ name }) =>
+ name === "better-auth.session_token" ||
+ name === "__Secure-better-auth.session_token",
+ );
+ if (!sessionCookie) return null;
+
+ const cookieHeader = cookieStore
+ .getAll()
+ .map(({ name, value }) => `${name}=${encodeURIComponent(value)}`)
+ .join("; ");
+
+ const baseURL =
+ process.env.BETTER_AUTH_URL ||
+ process.env.NEXT_PUBLIC_FRONTEND_BASE_URL ||
+ "http://localhost:3000";
+ // This is a request from the Next server back to itself, which the route
+ // handlers avoid by minting in-process (lib/auth/server/getServerAuthToken).
+ // This module is in the client bundle graph and so cannot import `auth`
+ // (-> `pg`), so the SSR path keeps the HTTP hop. Bound it: an unbounded
+ // self-request can occupy a worker waiting on a worker, and that deadlock
+ // is what made the Copilot page hang forever instead of erroring.
+ const response = await fetch(`${baseURL}/api/auth/token`, {
+ headers: { cookie: cookieHeader },
+ cache: "no-store",
+ signal: AbortSignal.timeout(10_000),
+ });
+ if (!response.ok) return null;
+
+ const { token } = (await response.json()) as { token?: string };
+ return token ?? null;
} catch (error) {
console.error("Failed to get auth token:", error);
return null;
diff --git a/autogpt_platform/frontend/src/lib/direct-upload.ts b/autogpt_platform/frontend/src/lib/direct-upload.ts
index b41078915e..7eb3582868 100644
--- a/autogpt_platform/frontend/src/lib/direct-upload.ts
+++ b/autogpt_platform/frontend/src/lib/direct-upload.ts
@@ -1,4 +1,4 @@
-import { getWebSocketToken } from "@/lib/supabase/actions";
+import { getWebSocketToken } from "@/lib/auth/actions";
import { environment } from "@/services/environment";
interface WorkspaceUploadResponse {
diff --git a/autogpt_platform/frontend/src/lib/supabase/__tests__/actions.test.ts b/autogpt_platform/frontend/src/lib/supabase/__tests__/actions.test.ts
deleted file mode 100644
index 4b2be6282e..0000000000
--- a/autogpt_platform/frontend/src/lib/supabase/__tests__/actions.test.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-
-const { cookieJar, mockSignOut } = vi.hoisted(() => ({
- cookieJar: new Map<string, string>(),
- mockSignOut: vi.fn(),
-}));
-
-vi.mock("next/headers", () => ({
- cookies: async () => ({
- getAll: () =>
- [...cookieJar.keys()].map((name) => ({
- name,
- value: cookieJar.get(name) ?? "",
- })),
- delete: (name: string) => {
- cookieJar.delete(name);
- },
- }),
-}));
-
-vi.mock("../server/getServerSupabase", () => ({
- getServerSupabase: async () => ({ auth: { signOut: mockSignOut } }),
-}));
-
-vi.mock("@sentry/nextjs", () => ({
- withServerActionInstrumentation: (
- _name: string,
- _options: unknown,
- fn: () => unknown,
- ) => fn(),
-}));
-
-import { serverLogout } from "../actions";
-
-function seedCookies() {
- cookieJar.set("sb-abc-auth-token", "session");
- cookieJar.set("sb-abc-auth-token.0", "chunk-0");
- cookieJar.set("sb-abc-auth-token.1", "chunk-1");
- cookieJar.set("unrelated-cookie", "keep-me");
-}
-
-beforeEach(() => {
- cookieJar.clear();
- seedCookies();
-});
-
-afterEach(() => {
- vi.clearAllMocks();
-});
-
-describe("serverLogout", () => {
- it("clears all sb-* auth cookies on successful sign-out", async () => {
- mockSignOut.mockResolvedValue({ error: null });
-
- const result = await serverLogout();
-
- expect(result).toEqual({ success: true });
- expect([...cookieJar.keys()]).toEqual(["unrelated-cookie"]);
- });
-
- it("clears auth cookies even when signOut returns an error, so the dead session cannot resurrect", async () => {
- mockSignOut.mockResolvedValue({
- error: { message: "session_not_found" },
- });
-
- const result = await serverLogout();
-
- expect(result).toEqual({ success: true });
- expect([...cookieJar.keys()]).toEqual(["unrelated-cookie"]);
- });
-
- it("clears auth cookies even when signOut throws", async () => {
- mockSignOut.mockRejectedValue(new Error("network down"));
-
- const result = await serverLogout();
-
- expect(result).toEqual({ success: true });
- expect([...cookieJar.keys()]).toEqual(["unrelated-cookie"]);
- });
-
- it("passes the global scope through to signOut", async () => {
- mockSignOut.mockResolvedValue({ error: null });
-
- await serverLogout({ globalLogout: true });
-
- expect(mockSignOut).toHaveBeenCalledWith({ scope: "global" });
- });
-});
diff --git a/autogpt_platform/frontend/src/lib/supabase/actions.ts b/autogpt_platform/frontend/src/lib/supabase/actions.ts
deleted file mode 100644
index 6722ffe0cb..0000000000
--- a/autogpt_platform/frontend/src/lib/supabase/actions.ts
+++ /dev/null
@@ -1,238 +0,0 @@
-"use server";
-import * as Sentry from "@sentry/nextjs";
-import type { User } from "@supabase/supabase-js";
-import { cookies } from "next/headers";
-import { getRedirectPath } from "./helpers";
-import { getServerSupabase } from "./server/getServerSupabase";
-
-export interface SessionValidationResult {
- user: User | null;
- isValid: boolean;
- redirectPath?: string;
-}
-
-export async function validateSession(
- currentPath: string,
-): Promise<SessionValidationResult> {
- return await Sentry.withServerActionInstrumentation(
- "validateSession",
- {},
- async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return {
- user: null,
- isValid: false,
- redirectPath: getRedirectPath(currentPath) || undefined,
- };
- }
-
- try {
- const {
- data: { user },
- error,
- } = await supabase.auth.getUser();
-
- if (error || !user) {
- const redirectPath = getRedirectPath(currentPath);
- return {
- user: null,
- isValid: false,
- redirectPath: redirectPath || undefined,
- };
- }
-
- return {
- user,
- isValid: true,
- };
- } catch (error) {
- console.error("Session validation error:", error);
- const redirectPath = getRedirectPath(currentPath);
- return {
- user: null,
- isValid: false,
- redirectPath: redirectPath || undefined,
- };
- }
- },
- );
-}
-
-export async function getCurrentUser(): Promise<{
- user: User | null;
- error?: string;
-}> {
- return await Sentry.withServerActionInstrumentation(
- "getCurrentUser",
- {},
- async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return {
- user: null,
- error: "Supabase client not available",
- };
- }
-
- try {
- const {
- data: { user },
- error,
- } = await supabase.auth.getUser();
-
- if (error) {
- return {
- user: null,
- error: error.message,
- };
- }
-
- return { user };
- } catch (error) {
- console.error("Get current user error:", error);
- return {
- user: null,
- error: error instanceof Error ? error.message : "Unknown error",
- };
- }
- },
- );
-}
-
-export async function getWebSocketToken(): Promise<{
- token: string | null;
- error?: string;
-}> {
- return await Sentry.withServerActionInstrumentation(
- "getWebSocketToken",
- {},
- async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return {
- token: null,
- error: "Supabase client not available",
- };
- }
-
- try {
- const {
- data: { session },
- error,
- } = await supabase.auth.getSession();
-
- if (error) {
- return {
- token: null,
- error: error.message,
- };
- }
-
- return { token: session?.access_token || null };
- } catch (error) {
- console.error("Get WebSocket token error:", error);
- return {
- token: null,
- error: error instanceof Error ? error.message : "Unknown error",
- };
- }
- },
- );
-}
-
-export type ServerLogoutOptions = {
- globalLogout?: boolean;
-};
-
-export async function serverLogout(options: ServerLogoutOptions = {}) {
- return await Sentry.withServerActionInstrumentation(
- "serverLogout",
- {},
- async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return { success: true };
- }
-
- try {
- const { error } = await supabase.auth.signOut({
- scope: options.globalLogout ? "global" : "local",
- });
-
- if (error) {
- console.error("Error logging out:", error);
- }
- } catch (error) {
- console.error("Logout error:", error);
- }
-
- // Always expire the auth cookies, even when signOut() fails (revoked or
- // already-rotated refresh token, Supabase API hiccup). If they survive,
- // the middleware still sees a session and bounces the user from /login
- // straight back into the app with a half-dead session: the paywall
- // re-mounts while every API call fails with a 401.
- await clearSupabaseAuthCookies();
-
- // No `revalidatePath`: `/` is a client-only spinner that redirects to
- // `/copilot`, so there is no RSC payload to invalidate. The cross-tab
- // storage listener calls `router.refresh()` for any visible page, and
- // the React Query cache is cleared client-side.
- return { success: true };
- },
- );
-}
-
-// Supabase SSR stores the session in `sb-<project-ref>-auth-token` cookies
-// (chunked as `.0`, `.1`, ... when large), all `sb-`-prefixed.
-async function clearSupabaseAuthCookies() {
- const cookieStore = await cookies();
- for (const cookie of cookieStore.getAll()) {
- if (cookie.name.startsWith("sb-")) {
- cookieStore.delete(cookie.name);
- }
- }
-}
-
-export async function refreshSession() {
- return await Sentry.withServerActionInstrumentation(
- "refreshSession",
- {},
- async () => {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return {
- user: null,
- error: "Supabase client not available",
- };
- }
-
- try {
- const {
- data: { user },
- error,
- } = await supabase.auth.refreshSession();
-
- if (error) {
- return {
- user: null,
- error: error.message,
- };
- }
-
- return { user };
- } catch (error) {
- console.error("Refresh session error:", error);
- return {
- user: null,
- error: error instanceof Error ? error.message : "Unknown error",
- };
- }
- },
- );
-}
diff --git a/autogpt_platform/frontend/src/lib/supabase/middleware.ts b/autogpt_platform/frontend/src/lib/supabase/middleware.ts
deleted file mode 100644
index cd1f4a240e..0000000000
--- a/autogpt_platform/frontend/src/lib/supabase/middleware.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-import { environment } from "@/services/environment";
-import { createServerClient } from "@supabase/ssr";
-import { NextResponse, type NextRequest } from "next/server";
-import { getCookieSettings, isAdminPage, isProtectedPage } from "./helpers";
-
-export async function updateSession(request: NextRequest) {
- let supabaseResponse = NextResponse.next({
- request,
- });
-
- const supabaseUrl = environment.getSupabaseUrl();
- const supabaseKey = environment.getSupabaseAnonKey();
- const isAvailable = Boolean(supabaseUrl && supabaseKey);
-
- if (!isAvailable) {
- return supabaseResponse;
- }
-
- try {
- const supabase = createServerClient(supabaseUrl, supabaseKey, {
- cookies: {
- getAll() {
- return request.cookies.getAll();
- },
- setAll(cookiesToSet) {
- cookiesToSet.forEach(({ name, value }) =>
- request.cookies.set(name, value),
- );
- supabaseResponse = NextResponse.next({
- request,
- });
- cookiesToSet.forEach(({ name, value, options }) => {
- supabaseResponse.cookies.set(name, value, {
- ...options,
- ...getCookieSettings(),
- });
- });
- },
- },
- });
-
- const userResponse = await supabase.auth.getUser();
- const user = userResponse.data.user;
- const userRole = user?.role;
-
- const url = request.nextUrl.clone();
- const pathname = request.nextUrl.pathname;
-
- // IMPORTANT: Avoid writing any logic between createServerClient and
- // supabase.auth.getUser(). A simple mistake could make it very hard to debug
- // issues with users being randomly logged out.
-
- // AUTH REDIRECTS
- // 1. Check if user is not authenticated but trying to access protected content
- if (!user) {
- const attemptingProtectedPage = isProtectedPage(pathname);
- const attemptingAdminPage = isAdminPage(pathname);
-
- if (attemptingProtectedPage || attemptingAdminPage) {
- const currentDest = url.pathname + url.search;
- url.pathname = "/login";
- url.search = `?next=${encodeURIComponent(currentDest)}`;
- return NextResponse.redirect(url);
- }
- }
-
- // 2. Check if user is authenticated but lacks admin role when accessing admin pages
- if (user && userRole !== "admin" && isAdminPage(pathname)) {
- url.pathname = "/";
- return NextResponse.redirect(url);
- }
-
- // IMPORTANT: You *must* return the supabaseResponse object as it is. If you're
- // creating a new response object with NextResponse.next() make sure to:
- // 1. Pass the request in it, like so:
- // const myNewResponse = NextResponse.next({ request })
- // 2. Copy over the cookies, like so:
- // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())
- // 3. Change the myNewResponse object to fit your needs, but avoid changing
- // the cookies!
- // 4. Finally:
- // return myNewResponse
- // If this is not done, you may be causing the browser and server to go out
- // of sync and terminate the user's session prematurely!
- } catch (error) {
- console.error("Failed to run Supabase middleware", error);
- }
-
- return supabaseResponse;
-}
diff --git a/autogpt_platform/frontend/src/lib/supabase/server/getServerSupabase.ts b/autogpt_platform/frontend/src/lib/supabase/server/getServerSupabase.ts
deleted file mode 100644
index f0ba4f2f57..0000000000
--- a/autogpt_platform/frontend/src/lib/supabase/server/getServerSupabase.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { createServerClient, type CookieOptions } from "@supabase/ssr";
-import { cache } from "react";
-import { getCookieSettings } from "../helpers";
-import { environment } from "@/services/environment";
-
-type Cookies = { name: string; value: string; options?: CookieOptions }[];
-
-export const getServerSupabase = cache(async () => {
- // Need require here, so Next.js doesn't complain about importing this on client side
- // eslint-disable-next-line @typescript-eslint/no-require-imports
- const { cookies } = require("next/headers");
- const cookieStore = await cookies();
-
- return createServerClient(
- environment.getSupabaseUrl(),
- environment.getSupabaseAnonKey(),
- {
- cookies: {
- getAll() {
- return cookieStore.getAll();
- },
- setAll(cookiesToSet: Cookies) {
- try {
- cookiesToSet.forEach(({ name, value, options }) => {
- cookieStore.set(name, value, {
- ...options,
- ...getCookieSettings(),
- });
- });
- } catch {
- // The `setAll` method was called from a Server Component.
- // This can be ignored if you have middleware refreshing
- // user sessions.
- }
- },
- },
- },
- );
-});
diff --git a/autogpt_platform/frontend/src/lib/supabase/server/getServerUser.ts b/autogpt_platform/frontend/src/lib/supabase/server/getServerUser.ts
deleted file mode 100644
index c8fc3e2b22..0000000000
--- a/autogpt_platform/frontend/src/lib/supabase/server/getServerUser.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { getServerSupabase } from "./getServerSupabase";
-
-export async function getServerUser() {
- const supabase = await getServerSupabase();
-
- if (!supabase) {
- return { user: null, error: "Failed to create Supabase client" };
- }
-
- try {
- const {
- data: { user },
- } = await supabase.auth.getUser();
- // if (error) {
- // // FIX: Suppressing error for now. Need to stop the nav bar calling this all the time
- // // console.error("Supabase auth error:", error);
- // return { user: null, role: null, error: `Auth error: ${error.message}` };
- // }
- if (!user) {
- return { user: null, role: null, error: "No user found in the response" };
- }
- const role = user.role || null;
- return { user, role, error: null };
- } catch (error) {
- console.error("Unexpected error in getServerUser:", error);
- return {
- user: null,
- role: null,
- error: `Unexpected error: ${(error as Error).message}`,
- };
- }
-}
diff --git a/autogpt_platform/frontend/src/lib/withRoleAccess.ts b/autogpt_platform/frontend/src/lib/withRoleAccess.ts
index 7b63253c56..f968c9fa07 100644
--- a/autogpt_platform/frontend/src/lib/withRoleAccess.ts
+++ b/autogpt_platform/frontend/src/lib/withRoleAccess.ts
@@ -1,7 +1,7 @@
import React from "react";
import * as Sentry from "@sentry/nextjs";
import { redirect } from "next/navigation";
-import { getServerUser } from "./supabase/server/getServerUser";
+import { getServerUser } from "./auth/server/getServerUser";
export async function withRoleAccess(allowedRoles: string[]) {
"use server";
diff --git a/autogpt_platform/frontend/src/middleware.ts b/autogpt_platform/frontend/src/middleware.ts
index b98280a3a2..595680a018 100644
--- a/autogpt_platform/frontend/src/middleware.ts
+++ b/autogpt_platform/frontend/src/middleware.ts
@@ -1,8 +1,8 @@
-import { updateSession } from "@/lib/supabase/middleware";
+import { authMiddleware } from "@/lib/auth/middleware";
import { NextResponse, type NextRequest } from "next/server";
export async function middleware(request: NextRequest) {
- // Redirect www to non-www so Supabase cookies are issued against a single,
+ // Redirect www to non-www so auth cookies are issued against a single,
// canonical host and avoid the auth/cookie domain mismatch (#9188).
// Use url.hostname (already lowercase-normalized by the URL parser) instead
// of the raw Host header, which RFC 7230 treats as case-insensitive.
@@ -12,7 +12,7 @@ export async function middleware(request: NextRequest) {
return NextResponse.redirect(url, 308);
}
- return await updateSession(request);
+ return await authMiddleware(request);
}
export const config = {
@@ -24,8 +24,7 @@ export const config = {
* - /favicon.ico (favicon file)
* - /auth/callback (OAuth callback - needs to work without auth)
* - /api/proxy (backend API proxy - the route handler authenticates
- * itself via httpOnly cookies; running supabase.auth.getUser() here
- * adds a Supabase auth-server round-trip to every API call)
+ * itself via httpOnly cookies)
* Feel free to modify this pattern to include more paths.
*
* Note: /auth/authorize and /auth/integrations/* ARE protected and need
diff --git a/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts b/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
index a7872cb706..85b6e7fec5 100644
--- a/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
+++ b/autogpt_platform/frontend/src/playwright/auth-happy-path.spec.ts
@@ -137,19 +137,20 @@ test("auth happy path: multi-tab logout clears shared builder sessions", async (
expect(consoleErrors).toHaveLength(0);
- // Prove the auth token is actually gone, not just the UI hidden. Supabase
- // overwrites the cookie on signout with an empty value + past expiry
+ // Prove the auth token is actually gone, not just the UI hidden. Sign-out
+ // may overwrite the session cookie with an empty value + past expiry
// rather than deleting it. An assertion that is silently skipped when the
// cookie is missing under the expected name would hide a real regression,
- // so we assert on every non-empty sb-*auth-token* cookie explicitly.
+ // so we assert on every better-auth.session_token cookie explicitly
+ // (including the `__Secure-` prefixed variant).
const cookiesAfterLogout = await context.cookies();
- const authCookies = cookiesAfterLogout.filter(
- (c) => c.name.startsWith("sb-") && c.name.includes("auth-token"),
+ const authCookies = cookiesAfterLogout.filter((c) =>
+ c.name.includes("better-auth.session_token"),
);
for (const cookie of authCookies) {
expect(
cookie.value,
- `supabase auth cookie ${cookie.name} must be empty after logout`,
+ `auth session cookie ${cookie.name} must be empty after logout`,
).toBe("");
}
diff --git a/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx b/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx
index e9bfe2a16a..ad5f928a05 100644
--- a/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx
+++ b/autogpt_platform/frontend/src/providers/agent-credentials/credentials-provider.tsx
@@ -11,7 +11,7 @@ import {
import { getGetV1ListCredentialsQueryKey } from "@/app/api/__generated__/endpoints/integrations/integrations";
import { postV2ExchangeOauthCodeForMcpTokens } from "@/app/api/__generated__/endpoints/mcp/mcp";
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { toDisplayName } from "@/providers/agent-credentials/helper";
import { hashKey, useQueryClient } from "@tanstack/react-query";
import { createContext, useCallback, useEffect, useState } from "react";
@@ -121,7 +121,7 @@ export default function CredentialsProvider({
const [systemProviders, setSystemProviders] = useState<Set<string>>(
new Set(),
);
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
const api = useBackendAPI();
const onFailToast = useToastOnFail();
const queryClient = useQueryClient();
diff --git a/autogpt_platform/frontend/src/providers/onboarding/__tests__/onboarding-provider-routing.test.tsx b/autogpt_platform/frontend/src/providers/onboarding/__tests__/onboarding-provider-routing.test.tsx
index 78273cbae2..6d8dbe73ae 100644
--- a/autogpt_platform/frontend/src/providers/onboarding/__tests__/onboarding-provider-routing.test.tsx
+++ b/autogpt_platform/frontend/src/providers/onboarding/__tests__/onboarding-provider-routing.test.tsx
@@ -17,8 +17,8 @@ vi.mock("next/navigation", () => ({
}));
let mockIsLoggedIn = true;
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: () => ({
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: () => ({
isLoggedIn: mockIsLoggedIn,
isUserLoading: false,
user: mockIsLoggedIn ? { id: "test-user", email: "[email protected]" } : null,
diff --git a/autogpt_platform/frontend/src/providers/onboarding/onboarding-provider.tsx b/autogpt_platform/frontend/src/providers/onboarding/onboarding-provider.tsx
index 339f8bc566..bf84ddff24 100644
--- a/autogpt_platform/frontend/src/providers/onboarding/onboarding-provider.tsx
+++ b/autogpt_platform/frontend/src/providers/onboarding/onboarding-provider.tsx
@@ -16,7 +16,7 @@ import {
WebSocketNotification,
} from "@/lib/autogpt-server-api";
import { useBackendAPI } from "@/lib/autogpt-server-api/context";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import {
createContext,
@@ -94,7 +94,7 @@ export default function OnboardingProvider({
const pathname = usePathname();
const searchParams = useSearchParams();
const router = useRouter();
- const { isLoggedIn } = useSupabase();
+ const { isLoggedIn } = useAuth();
useOnboardingTimezoneDetection();
diff --git a/autogpt_platform/frontend/src/providers/org-team/OrgTeamProvider.tsx b/autogpt_platform/frontend/src/providers/org-team/OrgTeamProvider.tsx
index 80aa0fe466..859ad84867 100644
--- a/autogpt_platform/frontend/src/providers/org-team/OrgTeamProvider.tsx
+++ b/autogpt_platform/frontend/src/providers/org-team/OrgTeamProvider.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useOrgTeamStore } from "@/services/org-team/store";
import { getQueryClient } from "@/lib/react-query/queryClient";
import { useEffect, useRef } from "react";
@@ -20,7 +20,7 @@ interface Props {
* On org/team switch: clears React Query cache to force refetch.
*/
export default function OrgTeamProvider({ children }: Props) {
- const { isLoggedIn, user, isUserLoading } = useSupabase();
+ const { isLoggedIn, user, isUserLoading } = useAuth();
const { activeOrgID, setActiveOrg, setOrgs, setLoaded, clearContext } =
useOrgTeamStore();
diff --git a/autogpt_platform/frontend/src/providers/org-team/__tests__/OrgTeamProvider.test.tsx b/autogpt_platform/frontend/src/providers/org-team/__tests__/OrgTeamProvider.test.tsx
index b3d3fb1e7c..fe6fa4a69d 100644
--- a/autogpt_platform/frontend/src/providers/org-team/__tests__/OrgTeamProvider.test.tsx
+++ b/autogpt_platform/frontend/src/providers/org-team/__tests__/OrgTeamProvider.test.tsx
@@ -2,12 +2,12 @@ import { useOrgTeamStore } from "@/services/org-team/store";
import { render, screen, waitFor } from "@/tests/integrations/test-utils";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-const { useSupabaseMock } = vi.hoisted(() => ({
- useSupabaseMock: vi.fn(),
+const { useAuthMock } = vi.hoisted(() => ({
+ useAuthMock: vi.fn(),
}));
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: useSupabaseMock,
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: useAuthMock,
}));
import OrgTeamProvider from "../OrgTeamProvider";
@@ -31,7 +31,7 @@ const COMPANY_ORG = {
};
function mockLoggedIn() {
- useSupabaseMock.mockReturnValue({
+ useAuthMock.mockReturnValue({
isLoggedIn: true,
user: { id: "user-1" },
isUserLoading: false,
@@ -39,7 +39,7 @@ function mockLoggedIn() {
}
function mockLoggedOut() {
- useSupabaseMock.mockReturnValue({
+ useAuthMock.mockReturnValue({
isLoggedIn: false,
user: null,
isUserLoading: false,
@@ -47,7 +47,7 @@ function mockLoggedOut() {
}
function mockSessionHydrating() {
- useSupabaseMock.mockReturnValue({
+ useAuthMock.mockReturnValue({
isLoggedIn: false,
user: null,
isUserLoading: true,
diff --git a/autogpt_platform/frontend/src/providers/posthog/posthog-provider.tsx b/autogpt_platform/frontend/src/providers/posthog/posthog-provider.tsx
index 674f6c55eb..c635a63d39 100644
--- a/autogpt_platform/frontend/src/providers/posthog/posthog-provider.tsx
+++ b/autogpt_platform/frontend/src/providers/posthog/posthog-provider.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { environment } from "@/services/environment";
import { PostHogProvider as PHProvider } from "@posthog/react";
import { usePathname, useSearchParams } from "next/navigation";
@@ -29,7 +29,7 @@ export function PostHogProvider({ children }: { children: ReactNode }) {
}
export function PostHogUserTracker() {
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
const previousUserIdRef = useRef<string | null>(null);
const isPostHogEnabled = environment.isPostHogEnabled();
diff --git a/autogpt_platform/frontend/src/services/environment/index.ts b/autogpt_platform/frontend/src/services/environment/index.ts
index 0214dcb3c8..dd2d70f9c7 100644
--- a/autogpt_platform/frontend/src/services/environment/index.ts
+++ b/autogpt_platform/frontend/src/services/environment/index.ts
@@ -44,18 +44,6 @@ function getAGPTWsServerUrl() {
return process.env.NEXT_PUBLIC_AGPT_WS_SERVER_URL || "ws://localhost:8001/ws";
}
-function getSupabaseUrl() {
- if (environment.isServerSide() && process.env.SUPABASE_URL) {
- return process.env.SUPABASE_URL;
- }
-
- return process.env.NEXT_PUBLIC_SUPABASE_URL || "http://localhost:8000";
-}
-
-function getSupabaseAnonKey() {
- return process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || "";
-}
-
function getEnvironmentStr() {
return `app:${getAppEnv().toLowerCase()}-behave:${getBehaveAs().toLowerCase()}`;
}
@@ -146,8 +134,6 @@ export const environment = {
getAGPTServerApiUrl,
getAGPTServerBaseUrl,
getAGPTWsServerUrl,
- getSupabaseUrl,
- getSupabaseAnonKey,
getPreviewStealingDev,
getPostHogCredentials,
getLaunchDarklyClientId,
diff --git a/autogpt_platform/frontend/src/services/feature-flags/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/services/feature-flags/__tests__/helpers.test.ts
index 65ae23445c..f10696758c 100644
--- a/autogpt_platform/frontend/src/services/feature-flags/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/services/feature-flags/__tests__/helpers.test.ts
@@ -1,18 +1,16 @@
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
import { describe, expect, it } from "vitest";
import { buildLDContext } from "../helpers";
function userFixture(overrides: Partial<User> = {}): User {
return {
id: "00000000-0000-0000-0000-000000000001",
- aud: "authenticated",
- app_metadata: {},
user_metadata: {},
created_at: "2026-05-08T12:00:00Z",
role: "authenticated",
...overrides,
- } as User;
+ };
}
describe("buildLDContext", () => {
@@ -39,7 +37,7 @@ describe("buildLDContext", () => {
});
});
- it("preserves the exact created_at string from Supabase (no normalization)", () => {
+ it("preserves the exact created_at string from the session (no normalization)", () => {
const ctx = buildLDContext(
userFixture({ created_at: "2025-01-15T08:30:45.123456Z" }),
);
@@ -50,9 +48,7 @@ describe("buildLDContext", () => {
});
it("omits created_at when missing — falsy spread skips the key", () => {
- const ctx = buildLDContext(
- userFixture({ created_at: undefined as unknown as string }),
- );
+ const ctx = buildLDContext(userFixture({ created_at: undefined }));
expect(ctx).not.toHaveProperty("created_at");
expect("email" in ctx && ctx.email).toBe("[email protected]");
diff --git a/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx b/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx
index 5df4b5a24a..58d52483e7 100644
--- a/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx
+++ b/autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx
@@ -1,7 +1,7 @@
"use client";
import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import * as Sentry from "@sentry/nextjs";
import { LDProvider } from "launchdarkly-react-client-sdk";
import type { ReactNode } from "react";
@@ -12,7 +12,7 @@ import { buildLDContext } from "./helpers";
const LAUNCHDARKLY_INIT_TIMEOUT_MS = 5000;
export function LaunchDarklyProvider({ children }: { children: ReactNode }) {
- const { user, isUserLoading } = useSupabase();
+ const { user, isUserLoading } = useAuth();
const envEnabled = environment.areFeatureFlagsEnabled();
const clientId = environment.getLaunchDarklyClientId();
diff --git a/autogpt_platform/frontend/src/services/feature-flags/helpers.ts b/autogpt_platform/frontend/src/services/feature-flags/helpers.ts
index 033039c66b..7f39e90c94 100644
--- a/autogpt_platform/frontend/src/services/feature-flags/helpers.ts
+++ b/autogpt_platform/frontend/src/services/feature-flags/helpers.ts
@@ -1,4 +1,4 @@
-import type { User } from "@supabase/supabase-js";
+import type { User } from "@/lib/auth/types";
export type LDUserContext =
| {
@@ -21,7 +21,7 @@ export type LDUserContext =
// (feature_flag.py:_fetch_user_context_data) so LaunchDarkly targeting
// rules evaluate identically on both sides.
//
-// Supabase JS emits `Z`-suffixed ISO; backend emits `+00:00` — LD date matchers accept both.
+// The auth session emits `Z`-suffixed ISO; backend emits `+00:00` — LD date matchers accept both.
export function buildLDContext(user: User | null): LDUserContext {
if (!user) {
return { kind: "user", key: "anonymous", anonymous: true };
diff --git a/autogpt_platform/frontend/src/services/push-notifications/__tests__/PushNotificationProvider.test.tsx b/autogpt_platform/frontend/src/services/push-notifications/__tests__/PushNotificationProvider.test.tsx
index 529c7817a0..bff0694d93 100644
--- a/autogpt_platform/frontend/src/services/push-notifications/__tests__/PushNotificationProvider.test.tsx
+++ b/autogpt_platform/frontend/src/services/push-notifications/__tests__/PushNotificationProvider.test.tsx
@@ -30,8 +30,8 @@ vi.mock("next/navigation", () => ({
}));
const mockUser = { id: "user-1", email: "[email protected]" };
-vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
- useSupabase: vi.fn(() => ({ user: mockUser })),
+vi.mock("@/lib/auth/hooks/useAuth", () => ({
+ useAuth: vi.fn(() => ({ user: mockUser })),
}));
const { notificationsEnabledMock } = vi.hoisted(() => ({
@@ -148,10 +148,10 @@ describe("PushNotificationProvider", () => {
searchParamsMock.mockReturnValue(new URLSearchParams("sessionId=A"));
notificationsEnabledMock.mockReturnValue(true);
- const { useSupabase } = await import("@/lib/supabase/hooks/useSupabase");
- vi.mocked(useSupabase).mockReturnValue({
+ const { useAuth } = await import("@/lib/auth/hooks/useAuth");
+ vi.mocked(useAuth).mockReturnValue({
user: mockUser,
- } as ReturnType<typeof useSupabase>);
+ } as ReturnType<typeof useAuth>);
Object.defineProperty(globalThis, "Notification", {
value: { permission: "granted" },
@@ -239,10 +239,10 @@ describe("PushNotificationProvider", () => {
});
it("skips when no user is authenticated", async () => {
- const { useSupabase } = await import("@/lib/supabase/hooks/useSupabase");
- vi.mocked(useSupabase).mockReturnValue({
+ const { useAuth } = await import("@/lib/auth/hooks/useAuth");
+ vi.mocked(useAuth).mockReturnValue({
user: null,
- } as ReturnType<typeof useSupabase>);
+ } as ReturnType<typeof useAuth>);
render(<PushNotificationProvider />);
@@ -316,16 +316,16 @@ describe("PushNotificationProvider", () => {
});
it("unsubscribes on logout after having been authenticated", async () => {
- const { useSupabase } = await import("@/lib/supabase/hooks/useSupabase");
+ const { useAuth } = await import("@/lib/auth/hooks/useAuth");
const { rerender } = render(<PushNotificationProvider />);
await waitFor(() => {
expect(mockSendSubscriptionToServer).toHaveBeenCalled();
});
- vi.mocked(useSupabase).mockReturnValue({
+ vi.mocked(useAuth).mockReturnValue({
user: null,
- } as ReturnType<typeof useSupabase>);
+ } as ReturnType<typeof useAuth>);
rerender(<PushNotificationProvider />);
await waitFor(() => {
@@ -337,10 +337,10 @@ describe("PushNotificationProvider", () => {
});
it("does not call teardown when user is null from the start", async () => {
- const { useSupabase } = await import("@/lib/supabase/hooks/useSupabase");
- vi.mocked(useSupabase).mockReturnValue({
+ const { useAuth } = await import("@/lib/auth/hooks/useAuth");
+ vi.mocked(useAuth).mockReturnValue({
user: null,
- } as ReturnType<typeof useSupabase>);
+ } as ReturnType<typeof useAuth>);
render(<PushNotificationProvider />);
diff --git a/autogpt_platform/frontend/src/services/push-notifications/usePushNotifications.ts b/autogpt_platform/frontend/src/services/push-notifications/usePushNotifications.ts
index 599c40b37b..2d55d3b54f 100644
--- a/autogpt_platform/frontend/src/services/push-notifications/usePushNotifications.ts
+++ b/autogpt_platform/frontend/src/services/push-notifications/usePushNotifications.ts
@@ -1,6 +1,6 @@
"use client";
-import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
+import { useAuth } from "@/lib/auth/hooks/useAuth";
import { useEffect, useRef, useState } from "react";
import { setupPushSubscription, teardownPushSubscription } from "./helpers";
import type { PushSWMessage } from "./types";
@@ -18,7 +18,7 @@ import type { PushSWMessage } from "./types";
* user doesn't keep receiving OS notifications.
*/
export function usePushNotifications() {
- const { user } = useSupabase();
+ const { user } = useAuth();
const registeredRef = useRef(false);
const wasAuthedRef = useRef(false);
const [renewCount, setRenewCount] = useState(0);
diff --git a/autogpt_platform/frontend/src/tests/integrations/mock-auth-request.tsx b/autogpt_platform/frontend/src/tests/integrations/mock-auth-request.tsx
new file mode 100644
index 0000000000..ba08315cd6
--- /dev/null
+++ b/autogpt_platform/frontend/src/tests/integrations/mock-auth-request.tsx
@@ -0,0 +1,20 @@
+import { vi } from "vitest";
+
+export function mockAuthRequest() {
+ // Keep the Better Auth server instance (pg pool, plugins) and next/headers
+ // out of the vitest module graph. The defaults emulate "no active session";
+ // tests that need user data should mock @/lib/auth/hooks/useAuth or
+ // @/lib/auth/actions in their own file.
+ vi.mock("@/lib/auth/auth", () => ({
+ auth: {
+ api: {
+ getSession: vi.fn().mockResolvedValue(null),
+ signOut: vi.fn().mockResolvedValue({ success: true }),
+ getToken: vi.fn().mockResolvedValue(null),
+ },
+ },
+ }));
+ vi.mock("@/lib/auth/server/getServerSession", () => ({
+ getServerSession: vi.fn().mockResolvedValue(null),
+ }));
+}
diff --git a/autogpt_platform/frontend/src/tests/integrations/mock-supabase-request.tsx b/autogpt_platform/frontend/src/tests/integrations/mock-supabase-request.tsx
deleted file mode 100644
index f7064c53f9..0000000000
--- a/autogpt_platform/frontend/src/tests/integrations/mock-supabase-request.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { vi } from "vitest";
-
-const mockSupabaseClient = {
- auth: {
- getUser: vi.fn().mockResolvedValue({
- data: { user: null },
- error: null,
- }),
- getSession: vi.fn().mockResolvedValue({
- data: { session: null },
- error: null,
- }),
- signOut: vi.fn().mockResolvedValue({ error: null }),
- refreshSession: vi.fn().mockResolvedValue({
- data: { session: null, user: null },
- error: null,
- }),
- },
-};
-
-export const mockSupabaseRequest = () => {
- vi.mock("@/lib/supabase/server/getServerSupabase", () => ({
- getServerSupabase: vi.fn().mockResolvedValue(mockSupabaseClient),
- }));
-};
diff --git a/autogpt_platform/frontend/src/tests/integrations/vitest.setup.tsx b/autogpt_platform/frontend/src/tests/integrations/vitest.setup.tsx
index 2efc544878..64d4f49a37 100644
--- a/autogpt_platform/frontend/src/tests/integrations/vitest.setup.tsx
+++ b/autogpt_platform/frontend/src/tests/integrations/vitest.setup.tsx
@@ -1,7 +1,7 @@
import { beforeAll, afterAll, afterEach, vi } from "vitest";
import { server } from "@/mocks/mock-server";
import { mockNextjsModules } from "./setup-nextjs-mocks";
-import { mockSupabaseRequest } from "./mock-supabase-request";
+import { mockAuthRequest } from "./mock-auth-request";
import { cleanup } from "@testing-library/react";
// React 18.3 only ships `cache` under the `react-server` export condition.
@@ -43,7 +43,7 @@ vi.mock("@number-flow/react", () => ({
beforeAll(() => {
mockNextjsModules();
- mockSupabaseRequest(); // If you need user's data - please mock supabase actions in your specific test - it sends null user [It's only to avoid cookies() call]
+ mockAuthRequest(); // If you need user's data - please mock auth actions in your specific test - it sends null user [It's only to avoid cookies() call]
return server.listen({ onUnhandledRequest: "error" });
});
afterEach(() => {
diff --git a/autogpt_platform/installer/setup-autogpt.bat b/autogpt_platform/installer/setup-autogpt.bat
index 7409b72c95..3298910f32 100644
--- a/autogpt_platform/installer/setup-autogpt.bat
+++ b/autogpt_platform/installer/setup-autogpt.bat
@@ -170,7 +170,7 @@ if errorlevel 1 (
echo Common issues:
echo - Docker is not running
echo - Insufficient disk space
- echo - Port conflicts ^(check if ports 3000, 8000, etc. are in use^)
+ echo - Port conflicts ^(check if ports 3000, 8006, etc. are in use^)
pause
exit /b 1
)
@@ -180,7 +180,7 @@ echo Setup Complete!
echo =============================
echo.
echo Access AutoGPT at: http://localhost:3000
-echo API available at: http://localhost:8000
+echo API available at: http://localhost:8006
if "%WITH_OLLAMA%"=="1" (
echo.
echo AutoPilot wired to Ollama ^(model: %OLLAMA_MODEL%^)
diff --git a/autogpt_platform/installer/setup-autogpt.sh b/autogpt_platform/installer/setup-autogpt.sh
index 24672b803e..1ce710ca4c 100755
--- a/autogpt_platform/installer/setup-autogpt.sh
+++ b/autogpt_platform/installer/setup-autogpt.sh
@@ -438,7 +438,7 @@ run_docker() {
print_color "YELLOW" "Common issues:"
print_color "YELLOW" "- Docker is not running"
print_color "YELLOW" "- Insufficient disk space"
- print_color "YELLOW" "- Port conflicts (check if ports 3000, 8000, etc. are in use)"
+ print_color "YELLOW" "- Port conflicts (check if ports 3000, 8006, etc. are in use)"
exit 1
fi
}
@@ -463,7 +463,7 @@ main() {
print_color "GREEN" "============================="
echo
print_color "BLUE" "🚀 Access AutoGPT at: http://localhost:3000"
- print_color "BLUE" "📡 API available at: http://localhost:8000"
+ print_color "BLUE" "📡 API available at: http://localhost:8006"
if [ "$WITH_OLLAMA" = true ]; then
echo
print_color "BLUE" "🦙 AutoPilot wired to Ollama (model: $OLLAMA_MODEL)"
diff --git a/docs/platform/advanced_setup.md b/docs/platform/advanced_setup.md
index d4c699cd39..227c2a6a01 100644
--- a/docs/platform/advanced_setup.md
+++ b/docs/platform/advanced_setup.md
@@ -45,7 +45,7 @@ This is useful when running on docker so you can copy the secrets into the conta
### PostgreSQL
-We use a Supabase PostgreSQL as the database. You will swap the commands you use to generate and run prisma to the following
+We use PostgreSQL (with the pgvector extension) as the database. You will swap the commands you use to generate and run prisma to the following
```bash
poetry run prisma generate --schema postgres/schema.prisma
diff --git a/docs/platform/contributing/oauth-integration-flow.md b/docs/platform/contributing/oauth-integration-flow.md
index f6c3f7fd17..cf0c6dfa68 100644
--- a/docs/platform/contributing/oauth-integration-flow.md
+++ b/docs/platform/contributing/oauth-integration-flow.md
@@ -4,18 +4,18 @@
The AutoGPT platform implements OAuth 2.0 in two distinct contexts:
-1. **User Authentication (SSO)**: Handled by Supabase for platform login
+1. **User Authentication (SSO)**: Handled by Better Auth, embedded in the Next.js frontend at `/api/auth/*`
2. **API Integration Credentials**: Custom OAuth implementation for third-party service access
-This document focuses on the **API Integration OAuth flow** used for connecting to external services. For the list of supported providers, see `/backend/backend/integrations/providers.py`. For user authentication documentation, see the Supabase auth implementation.
+This document focuses on the **API Integration OAuth flow** used for connecting to external services. For the list of supported providers, see `autogpt_platform/backend/backend/integrations/providers.py`. For user authentication documentation, see `autogpt_platform/frontend/src/lib/auth/SESSION_VALIDATION.md`.
## Trust Boundaries
### 1. Frontend Trust Boundary
- **Location**: Browser/Client-side application
- **Components**:
- - `CredentialsInput` component (`/frontend/src/components/integrations/credentials-input.tsx`)
- - OAuth callback route (`/frontend/src/app/(platform)/auth/integrations/oauth_callback/route.ts`)
+ - `CredentialsInput` component (`autogpt_platform/frontend/src/components/contextual/CredentialsInput/CredentialsInput.tsx`)
+ - OAuth callback route (`autogpt_platform/frontend/src/app/(platform)/auth/integrations/oauth_callback/route.ts`)
- **Trust Level**: Untrusted - user-controlled environment
- **Security Measures**:
- CSRF protection via state tokens
@@ -25,9 +25,9 @@ This document focuses on the **API Integration OAuth flow** used for connecting
### 2. Backend API Trust Boundary
- **Location**: Server-side FastAPI application
- **Components**:
- - Integration router (`/backend/backend/api/features/integrations/router.py`)
- - OAuth handlers (`/backend/backend/integrations/oauth/`)
- - Credentials store (`/backend/backend/integrations/credentials_store.py`)
+ - Integration router (`autogpt_platform/backend/backend/api/features/integrations/router.py`)
+ - OAuth handlers (`autogpt_platform/backend/backend/integrations/oauth/`)
+ - Credentials store (`autogpt_platform/backend/backend/integrations/credentials_store.py`)
- **Trust Level**: Trusted - server-controlled environment
- **Security Measures**:
- JWT-based authentication
@@ -150,7 +150,7 @@ graph TB
subgraph "OAuth Use Cases"
subgraph "User SSO Login"
LP[Login Page]
- SB[Supabase Auth]
+ SB[Better Auth]
GO[Google OAuth SSO]
SC[Session Cookies]
end
@@ -164,7 +164,7 @@ graph TB
subgraph "Backend API (Trusted)"
subgraph "Auth Management"
- SA[Supabase Client]
+ SA["JWT Validation (JWKS)"]
UM[User Management]
end
@@ -179,7 +179,6 @@ graph TB
subgraph "Storage"
RD[(Redis)]
PG[(PostgreSQL)]
- SDB[(Supabase DB)]
end
subgraph "External Providers"
@@ -194,7 +193,7 @@ graph TB
SB -->|OAuth Request| GO
GO -->|User Auth| SB
SB -->|Session| SC
- SB -->|User Data| SDB
+ SB -->|User Data| PG
%% API Integration Flow
UI -->|1. Initiate OAuth| IR
@@ -322,21 +321,21 @@ stateDiagram-v2
## OAuth Types Comparison
-### User Authentication (SSO) via Supabase
+### User Authentication (SSO) via Better Auth
- **Purpose**: Authenticate users to access the AutoGPT platform
-- **Provider**: Supabase Auth (currently supports Google SSO)
-- **Flow Path**: `/login` → Supabase OAuth → `/auth/callback`
-- **Session Storage**: Supabase-managed cookies
-- **Token Management**: Automatic by Supabase
+- **Provider**: Better Auth, embedded in the Next.js frontend (supports Google, GitHub, and Discord SSO)
+- **Flow Path**: `/login` → `/api/auth/*` (Better Auth) → provider OAuth → back to the app
+- **Session Storage**: Better Auth-managed cookies
+- **Token Management**: Automatic by Better Auth; the Python backend validates JWTs via the JWKS endpoint (`/api/auth/jwks`)
- **User Experience**: Single sign-on to the platform
### API Integration Credentials
- **Purpose**: Grant AutoGPT access to user's third-party services
- **Providers**: Examples include GitHub, Google APIs, Notion, and others
- - Full list in `/backend/backend/integrations/providers.py`
- - OAuth handlers in `/backend/backend/integrations/oauth/`
+ - Full list in `autogpt_platform/backend/backend/integrations/providers.py`
+ - OAuth handlers in `autogpt_platform/backend/backend/integrations/oauth/`
- **Flow Path**: Integration settings → `/api/integrations/{provider}/login` → `/auth/integrations/oauth_callback`
- **Credential Storage**: Encrypted in PostgreSQL
- **Token Management**: Custom refresh logic with mutex locking
@@ -388,8 +387,8 @@ stateDiagram-v2
### Supported Providers
The platform supports various OAuth providers including GitHub, Google, Notion, Twitter, and others. For the complete list, see:
-- `/backend/backend/integrations/providers.py` - All supported providers
-- `/backend/backend/integrations/oauth/` - OAuth implementations
+- `autogpt_platform/backend/backend/integrations/providers.py` - All supported providers
+- `autogpt_platform/backend/backend/integrations/oauth/` - OAuth implementations
### Provider-Specific Security Considerations
diff --git a/docs/platform/getting-started.md b/docs/platform/getting-started.md
index cbf5c541f5..dfb5199a2a 100644
--- a/docs/platform/getting-started.md
+++ b/docs/platform/getting-started.md
@@ -57,28 +57,6 @@ docker compose -v
Once you have Docker and Docker Compose installed, you can proceed to the next step.
-<details>
- <summary>
- Raspberry Pi 5 Specific Notes
- </summary>
- On Raspberry Pi 5 with Raspberry Pi OS, the default 16K page size will cause issues with the <code>supabase-vector</code> container (expected: 4K).
- </br>
- To fix this, edit <code>/boot/firmware/config.txt</code> and add:
- </br>
- ```ini
- kernel=kernel8.img
- ```
- Then reboot. You can check your page size with:
- </br>
- ```bash
- getconf PAGESIZE
- ```
- <code>16384</code> means 16K (incorrect), and <code>4096</code> means 4K (correct).
- After adjusting, <code>docker compose up -d --build</code> should work normally.
- </br>
- See <a href="https://github.com/supabase/supabase/issues/33816">supabase/supabase #33816</a> for additional context.
-</details>
-
## Quick Setup with Auto Setup Script (Recommended)
If you're self-hosting AutoGPT locally, we recommend using our official setup script to simplify the process. This will install dependencies (like Docker), pull the latest code, and launch the app with minimal effort.
@@ -142,7 +120,8 @@ Inside the `autogpt_platform` directory, you can use:
| Command | What it Does |
|------------------------|-------------------------------------------------------------------------------|
-| `make start-core` | Start just the core services (Supabase, Redis, RabbitMQ) in background |
+| `make init-env` | Create missing `.env` files from `.env.default` (`autogpt_platform`, `backend`, and `frontend`) |
+| `make start-core` | Start just the core services (Postgres, Redis, RabbitMQ) in background |
| `make stop-core` | Stop the core services |
| `make logs-core` | Tail the logs for core services |
| `make format` | Format & lint backend (Python) and frontend (TypeScript) code |
@@ -152,11 +131,16 @@ Inside the `autogpt_platform` directory, you can use:
*Example usage:*
```sh
+make init-env
make start-core
make run-backend
make run-frontend
```
+> `make init-env` matters when running the frontend outside Docker: Next.js
+> only reads `.env` (not `.env.default`), and the frontend's embedded auth
+> service needs `DATABASE_URL` and `BETTER_AUTH_SECRET` from it.
+
You can always check available Makefile recipes by running:
```sh
make help
@@ -177,6 +161,136 @@ Frontend UI Server: 3000
Backend Websocket Server: 8001
Execution API Rest Server: 8006
+### Upgrading an existing (Supabase-based) installation
+
+Older versions of the platform ran authentication on a bundled Supabase
+stack. If you self-hosted before the switch to the built-in auth service,
+three things changed:
+
+1. **Environment files**: refresh your `.env` files against the new
+ `.env.default`s. `make init-env` copies `.env.default` → `.env` for
+ `autogpt_platform`, `backend` and `frontend`, but only where no `.env`
+ exists yet (it uses `cp -n`): it creates missing `.env` *files* and never
+ overwrites an existing one. It does **not** merge newly-added variables
+ into an `.env` you already have — for an existing install, diff each
+ `.env` against its `.env.default` and copy the new keys across yourself.
+ The `SUPABASE_*` URL/key variables are gone; the frontend now uses
+ `BETTER_AUTH_SECRET` and `DATABASE_URL`.
+2. **Database location**: the database now lives in a plain Postgres
+ container (`pgvector/pgvector:pg15`) with its data in
+ `autogpt_platform/data/db/data`. Your old data is untouched at
+ `autogpt_platform/db/docker/volumes/db/data` but is no longer mounted.
+
+ If you already booted the new stack while that folder was still called
+ `volumes/`, move your data across before starting it again:
+ ```sh
+ mkdir -p autogpt_platform/data/db
+ mv autogpt_platform/volumes/db/data autogpt_platform/data/db/data
+ ```
+
+ To carry the old Supabase data over, pick one of the two routes below.
+ **Neither has been validated against a real old volume yet, so back up
+ `autogpt_platform/db/docker/volumes/db/data` before you start.**
+
+ The old bundled stack ran `supabase/postgres:15.8.1.049` and the new `db`
+ service runs `pgvector/pgvector:pg15` — the same Postgres major, so
+ reusing the data directory as-is is plausible rather than impossible. It
+ is not guaranteed: a data directory is only portable between servers on
+ the same major *and* with a compatible extension set /
+ `shared_preload_libraries`. The Supabase image ships extensions and roles
+ (`supabase_admin`, `pgjwt`, `pgsodium`, `pg_graphql`, …) that the plain
+ pgvector image does not have, so a moved directory can fail to start, or
+ start and then fail on objects that reference the missing extensions.
+
+ *Fast path — reuse the data directory:*
+ ```sh
+ cd autogpt_platform
+ docker compose down
+ mkdir -p data/db
+ rm -rf data/db/data # discards a freshly-initialised new DB
+ cp -a db/docker/volumes/db/data data/db/data # copy, so the old dir stays intact
+ docker compose up -d db
+ docker compose logs -f db
+ ```
+ On Linux the data directory is mode `0700` owned by the container's
+ `postgres` user, so the copy needs `sudo cp -a` (the plain Postgres
+ entrypoint fixes ownership on first boot). On Docker Desktop for
+ macOS/Windows the plain `cp -a` is enough.
+ It worked if the log settles on `database system is ready to accept
+ connections` and your data is there:
+ ```sh
+ docker compose exec db psql -U postgres -c '\dn'
+ docker compose exec db psql -U postgres -c 'select count(*) from platform."User"'
+ ```
+ It did not work if the container restart-loops with errors such as
+ `could not open configuration file`, `could not access file "$libdir/…"`,
+ `unrecognized configuration parameter`, `extension "…" is not available`,
+ `data directory … has wrong ownership`, or `Permission denied` — Postgres
+ is either missing something the Supabase image provided, or can't read the
+ copied files. In that case `rm -rf data/db/data` and use the fallback.
+
+ *Fallback — same-major dump and restore:*
+
+ Step 1 starts a real Postgres server against your **original** data
+ directory, read-write. Make sure you took the backup above first.
+ ```sh
+ cd autogpt_platform
+ # 1. Bring the OLD image up against the OLD data directory, on a spare port.
+ docker run --rm -d --name old-db -p 5433:5432 \
+ -e POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password \
+ -v "$(pwd)/db/docker/volumes/db/data:/var/lib/postgresql/data" \
+ supabase/postgres:15.8.1.049
+ # 2. Dump without Supabase-owned ownership/ACL metadata.
+ docker exec old-db pg_dump -U postgres -d postgres \
+ --no-owner --no-privileges -Fc -f /tmp/old.dump
+ docker cp old-db:/tmp/old.dump ./old.dump
+ docker stop old-db
+ # 3. Restore into the new db service (fresh volume).
+ docker compose up -d db
+ # A fresh volume runs db/init/00-init.sql, which creates an EMPTY auth.users
+ # shim with only the columns the migrations need. Drop it first, or the
+ # restore of your real auth.users collides with it and copies no users.
+ docker compose exec db psql -U postgres -c 'DROP SCHEMA IF EXISTS auth CASCADE;'
+ docker compose cp ./old.dump db:/tmp/old.dump
+ docker compose exec db pg_restore -U postgres -d postgres \
+ --no-owner --no-privileges /tmp/old.dump
+ # 4. Confirm your accounts actually landed BEFORE migrating.
+ docker compose exec db psql -U postgres -c 'select count(*) from auth.users'
+ ```
+ `pg_restore` reports errors for objects belonging to Supabase-only
+ extensions and roles (`storage`, `realtime`, `supabase_admin`, `pgsodium`,
+ …). Those are harmless. An error on **`auth.users`** is not: that table is
+ where your accounts live, and the migration in step 3 below copies them out
+ of it. If the count above is `0` — or `pg_restore` failed on `auth.users` —
+ stop and fix the restore before continuing, or you will bring the stack up
+ with no user accounts.
+
+ Either way, finish with the migrations before bringing up the rest:
+ ```sh
+ docker compose run --rm migrate
+ docker compose up -d
+ ```
+3. **User accounts and sessions**: a normal upgrade (stack stopped, then
+ restarted on the new version) needs no extra step here.
+
+ - Existing users are copied from the Supabase `auth.users` table into the
+ Better Auth tables by the backend Prisma migration
+ `20260716120000_copy_supabase_users_to_better_auth`, which runs as part
+ of the `docker compose run --rm migrate` step above.
+ - Existing browser sessions keep working because the frontend recognises
+ old Supabase JWT cookies and swaps them for a Better Auth session on
+ the user's next visit. Keep `SUPABASE_JWT_SECRET` set in
+ `frontend/.env` for as long as you want that bridge open.
+ - `frontend/scripts/migrate-supabase-auth.ts` is **optional** and only
+ applies to a *live* cutover, where Supabase kept accepting signups
+ while the new stack was already running. It is a re-runnable sweep for
+ those stragglers; if you stopped the stack to upgrade, skip it.
+ ```sh
+ cd frontend && DATABASE_URL=postgresql://postgres:<password>@localhost:5432/postgres npx tsx scripts/migrate-supabase-auth.ts
+ ```
+
+A fresh install (empty database) needs none of this.
+
### Additional Notes
You may want to change your encryption key in the `.env` file in the `autogpt_platform/backend` directory.
@@ -195,9 +309,20 @@ poetry run cli gen-encrypt-key
Then, replace the existing key in the `autogpt_platform/backend/.env` file with the new one.
+#### Auth transport security (JWKS over untrusted networks)
+
+The backend verifies login tokens using signing keys it fetches from the frontend at `JWT_JWKS_URL` (`.../api/auth/jwks`). It trusts whatever keys that URL returns, so the fetch must run over a **trusted path**:
+
+- **Plain `http` is fine** for `localhost` and for container-to-container traffic on a single host (the default `http://frontend:3000` over the Docker network) — there is no network segment for an attacker to sit on.
+- **Use `https` on an untrusted network.** If you split the backend and frontend across separate machines on a LAN, or expose them publicly, a cleartext JWKS fetch can be intercepted: an attacker who swaps the published keys can forge tokens for any user. Put the frontend behind TLS (a reverse proxy), or issue **locally-trusted certificates** (e.g. [mkcert](https://github.com/FiloSottile/mkcert)), and point `JWT_JWKS_URL` at the `https://` URL.
+
+The backend refuses to start if `JWT_JWKS_URL` is a cleartext `http://` URL pointing at a non-local host. If your network path is trusted (e.g. an isolated private LAN), set `JWKS_ALLOW_INSECURE_TRANSPORT=true` to boot anyway — a startup warning stays on record so the tradeoff is visible in logs.
+
+This is a property of stateless JWT/JWKS verification in general, not something specific to AutoGPT. On a standard single-host Docker install you don't need to change anything.
+
### 📌 Windows Installation Note
-When installing Docker on Windows, it is **highly recommended** to select **WSL 2** instead of Hyper-V. Using Hyper-V can cause compatibility issues with Supabase, leading to the `supabase-db` container being marked as **unhealthy**.
+When installing Docker on Windows, it is **highly recommended** to select **WSL 2** instead of Hyper-V. Using Hyper-V can cause compatibility issues with the platform's containers, leading to the `db` (Postgres) container being marked as **unhealthy**.
#### **Steps to enable WSL 2 for Docker:**
1. Install [WSL 2](https://learn.microsoft.com/en-us/windows/wsl/install).
diff --git a/docs/platform/new_blocks.md b/docs/platform/new_blocks.md
index 61f8d06e84..2a15c637c2 100644
--- a/docs/platform/new_blocks.md
+++ b/docs/platform/new_blocks.md
@@ -315,7 +315,7 @@ class BlockWithAPIKeyAndOAuth(Block):
The credentials will be automagically injected by the executor in the back end.
-The `APIKeyCredentials` and `OAuth2Credentials` models are defined [here](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/autogpt_libs/autogpt_libs/supabase_integration_credentials_store/types.py).
+The `APIKeyCredentials` and `OAuth2Credentials` models are defined [here](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/data/model.py).
To use them in e.g. an API request, you can either access the token directly:
```python