Stateless auth proxy that converts AT Protocol native apps from public to confidential OAuth clients. Deploy once, get 180-day refresh token
README.md
# atproto-auth-proxy A generic, stateless auth proxy that converts any AT Protocol native app from a public OAuth client to a confidential client. Deploy it once and your users get confidential-client session lifetimes (on Bluesky's auth server today: refresh tokens that survive 3 months of inactivity inside a 2-year session) instead of the 2-week hard cap applied to public clients — no more forced re-logins every two weeks. ## Quick Start ```bash # 1. Generate a signing key openssl ecparam -genkey -name prime256v1 -noout | openssl pkcs8 -topk8 -nocrypt -out auth-key.pem # 2. Run the proxy AUTH_PRIVATE_KEY=$(cat auth-key.pem) \ AUTH_CLIENT_ID="https://yourapp.com/oauth/client-metadata.json" \ ./atproto-auth-proxy # 3. Update your client-metadata.json (see "Client Metadata Changes" below) ``` ## Docker ```bash # Build docker build -t atproto-auth-proxy . # Run docker run -e AUTH_PRIVATE_KEY="$(cat auth-key.pem)" \ -e AUTH_CLIENT_ID="https://yourapp.com/oauth/client-metadata.json" \ -p 8080:8080 \ atproto-auth-proxy ``` ## Deploy to Railway Railway builds the Dockerfile and provisions HTTPS certificates for custom domains. From a clone of this repository: ```bash # 1. Create a project and a service, and link this directory to them railway init --name atproto-auth-proxy railway add --service atproto-auth-proxy railway service link atproto-auth-proxy # 2. Add the variables railway variable set AUTH_CLIENT_ID=https://yourapp.com/oauth/client-metadata.json --skip-deploys railway variable set AUTH_PRIVATE_KEY --stdin --skip-deploys < auth-key.pem railway variable set AUTH_TRUST_PROXY_HEADERS=true --skip-deploys railway variable set PORT=8080 --skip-deploys # 3. Have Railway check /health before a new deployment takes traffic railway environment edit --service-config atproto-auth-proxy deploy.healthcheckPath /health # 4. Deploy, then add your domain and create the CNAME and TXT records it prints railway up railway domain auth.yourapp.com --port 8080 ``` `railway up` uploads…