-
-
Notifications
You must be signed in to change notification settings - Fork 684
Open
Description
Description
On a self-hosted Logto instance, the Security page in the Admin Console fails to load with persistent 401 Unauthorized errors. This occurs on fresh installs across multiple Logto versions.
Environment
- Logto Version: 1.35.0 (also tested on 1.20.0 and 1.34.0 - same issue)
- Deployment: Docker (official
ghcr.io/logto-io/logto:latestimage) - Database: PostgreSQL 16
- Proxy: Cloudflare Tunnel with
TRUST_PROXY_HEADER=1
Configuration
environment:
- TRUST_PROXY_HEADER=1
- DB_URL=postgresql://logto:***@logto-db:5432/logto
- ENDPOINT=https://auth.example.com
- ADMIN_ENDPOINT=https://admin.example.comSteps to Reproduce
- Deploy fresh self-hosted Logto instance
- Complete initial admin account setup
- Navigate to Admin Console → Security page
- Observe 401 errors in browser console
Expected Behavior
Security page should load and allow configuration of password policy, CAPTCHA, blocklist settings.
Actual Behavior
Multiple API endpoints return 401 Unauthorized:
GET https://auth.example.com/api/sign-in-exp 401 (Unauthorized)
GET https://auth.example.com/api/captcha-provider 401 (Unauthorized)
The error response includes an unusual details field:
{
"code": "auth.unauthorized",
"data": {},
"details": "Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON",
"message": "Unauthorized. Please check credentials and its scope."
}Additional Context
- The
/meendpoint works correctly (returns 200) - The
/api/.well-known/sign-in-exppublic endpoint works correctly - Other Admin Console pages (Applications, Connectors, Users) work fine
- Issue persists after:
- Fresh database seed
- Clearing all OIDC sessions
- Multiple Logto versions
- Using official Docker image vs custom builds
Logs
OPTIONS /api/sign-in-exp 204 3ms
GET /api/sign-in-exp 401 1,071ms 174b
OPTIONS /api/captcha-provider 204 2ms
GET /api/captcha-provider 401 578ms 174b
The strange details field with "Unexpected token '<'" suggests something is trying to parse an HTML response as JSON internally, but this occurs even when CAPTCHA is not configured.
Metadata
Metadata
Assignees
Labels
No labels