Install
$ agentstack add skill-ngerakines-atproto-skills-atproto-oauth ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
AT Protocol OAuth
AT Protocol OAuth is an OAuth 2.1 profile with mandatory PKCE (S256), PAR, DPoP, and URL-based dynamic client registration via a published client metadata document. No client_secret — confidential clients authenticate to the token endpoint with a private_key_jwt assertion (ES256). Public / SPA / native clients authenticate by DPoP proof alone.
This skill routes to per-language guides for Rust, TypeScript, and Go, sitting on top of a language-neutral spec in shared/.
Defaults
client_idis a URL. It resolves to a JSON metadata document the AS fetches on demand. The URL path, host, and protocol must match byte-for-byte between registration, PAR, and authorize.- Every access token is DPoP-bound.
dpop_bound_access_tokens: trueis required in client metadata; every resource request carries a fresh DPoP proof withath = SHA-256(access_token)and a per-originnonce. - PAR is required. You push the authorize request to
pushed_authorization_request_endpointand redirect the user to{AS}/oauth/authorize?client_id=...&request_uri=urn:ietf:params:oauth:request_uri:.... Query parameters never hit the user-agent. - Scopes start with
atproto. All flows must requestatprotoas the first scope. Further scopes are layered on:transition:generic,account:email?action=read,rpc:app.bsky.feed.*,include:, etc. - The session belongs to the DID.
subin the token response is a DID. Handles may change; DIDs don't. Persist by DID. - Identity verification is mandatory:
sub→ DID document →#atproto_pds→ matches the PDS you discovered →authorization_servers[0]→ matches the AS you talked to. Skip this step = CSRF window.
Full normative rules: shared/spec.md, shared/flows.md, shared/client-metadata.md, shared/dpop.md, shared/scopes.md, shared/sessions.md, shared/security-requirements.md. Fixtures: shared/test-vectors.md. Common failures: shared/troubleshooting.md. Cross-language differences: shared/divergence-matrix.md.
Language detection
Before generating or reviewing any OAuth code, determine the target language from project files or the file being edited:
Cargo.toml,*.rs, mention ofatproto-oauth/atproto-identity/atproto-oauth-aip→ Rust — read fromrust/.package.json,tsconfig.json,*.ts,*.tsx, imports of@atproto/oauth-client-node/@atproto/oauth-client-browser/@atproto/oauth-client/@atproto/jwk-jose→ TypeScript — read fromtypescript/. Also*.js/*.jsxwhen there's no.ts.go.mod,*.go, imports ofgithub.com/bluesky-social/indigo/atproto/auth/oauth→ Go — read fromgo/.
Prefer the file being edited over the repo root when they disagree.
If multiple languages are present and the task doesn't point at one unambiguously, ask which one applies. Never mix OAuth libraries across languages in generated code.
If an unsupported language is detected (Python, Java, Swift, Kotlin, …), point the user at shared/spec.md, shared/flows.md, and shared/dpop.md for the wire format, and offer the TypeScript @atproto/oauth-client-node source as the most complete reference implementation to transliterate from.
Client-type detection
Before picking a file, also determine what kind of client is being built:
| Kind | Clue | Route to… | | -------------------- | --------------------------------------------------- | -------------------------------------------------------- | | Confidential (BFF) | Has server-side Rust/TS/Go code + a signing key | Node: typescript/*.md with NodeOAuthClient. Rust/Go: only option. | | Public (SPA) | Browser-only; no server; tokens land in the browser | TypeScript only → typescript/*.md with BrowserOAuthClient. Rust and Go don't ship a browser client. | | Public (native) | Desktop / mobile app with custom-scheme redirects | TypeScript (NodeOAuthClient with token_endpoint_auth_method: none). Rust can do it manually. Go: unsupported. | | AS or resource server | Implementing the server side (rare) | Rust only (rust/dpop.md §server-side). TS and Go don't ship validators. |
When in doubt, default to confidential BFF — it's the recommended pattern for any app that has a backend, and it keeps secrets out of the browser.
Reading guide
For every OAuth task:
- Read the relevant
shared/*.mdfirst. They define the rules your code must enforce. Usuallyshared/spec.md+ one ofshared/flows.md/shared/dpop.md/shared/sessions.md/shared/client-metadata.md/shared/scopes.md. - Read the relevant task file in the detected language directory:
- Publishing
/oauth-client-metadata.json+/jwks.json→{lang}/client-metadata.md - Authorize / callback / refresh / logout flow →
{lang}/flows.md - DPoP minting + nonce retry + server-side validation →
{lang}/dpop.md - Pre-flow state, sessions, refresh-race mitigation →
{lang}/sessions.md - Library setup, public API, idioms →
{lang}/README.md
- Consult
shared/divergence-matrix.mdwhenever porting between languages or reviewing cross-stack interop. - Consult
shared/troubleshooting.mdwhen debugging a specific failure (invalid_dpop_proof,invalid_grant, callback cookie missing, etc.). - Before publishing a metadata doc, run
scripts/validate_client_metadata.pyagainst the served URL.
Always prefer the official library over hand-rolling: atproto-oauth in Rust, @atproto/oauth-client-* in TypeScript, indigo/atproto/auth/oauth in Go. The protocol is small but unforgiving — every byte of the wire matters.
The conceptual stack
┌─────────────────────────────────────────────┐
│ Client metadata document (JSON at client_id)│ ← published by you
│ { client_id, redirect_uris, jwks_uri, … } │
└─────────────────────────────────────────────┘
│ fetched once by AS
▼
┌─────────────────────────────────────────────┐
│ PAR → /oauth/par │ ← flow starts
│ POST client_assertion + DPoP + PKCE + scope │
│ ↓ │
│ request_uri: urn:ietf:params:oauth:request_uri:…│
└─────────────────────────────────────────────┘
│ redirect user agent to authorize
▼
┌─────────────────────────────────────────────┐
│ User logs in at AS's UI, grants consent │
│ ↓ │
│ Redirect back: ?code=…&state=…&iss=… │
└─────────────────────────────────────────────┘
│ callback
▼
┌─────────────────────────────────────────────┐
│ /oauth/token (code exchange) │
│ POST code + PKCE verifier + assertion + DPoP │
│ ↓ │
│ { access_token, refresh_token, sub: did, │
│ aud: pds_url, expires_in: 3600 } │
└─────────────────────────────────────────────┘
│ persist session by DID
▼
┌─────────────────────────────────────────────┐
│ Resource request to PDS │
│ Authorization: DPoP │
│ DPoP: │
└─────────────────────────────────────────────┘
Cross-language hazards to flag up front
High-frequency failure modes; full detail in shared/divergence-matrix.md:
- Refresh race — Two concurrent requests both refresh, one invalidates the other's refresh token, dead session. TS has
NodeRequestLockbuilt in; Rust and Go leave it to the caller. Every production BFF needs a per-DID lock (Redis/Postgres advisory or in-process mutex). htunormalization — Query strings and fragments must be stripped before minting a DPoP proof; default ports must be elided. TS does this automatically; Rust and Go don't.invalid_dpop_proofwith identical-looking URLs = suspect this.- Rust's hard-coded
ES256header —auth_dpop()writesalg: ES256into the JWT header even when the key is P-384. Non-P-256 keys needdpop::mintwith a custom header. - Rust leaks private JWK components —
jwk::generate()on a privateKeyDataserializes thedfield unless the caller runsto_public(&key)first. TS and Go strip automatically. - Go is BFF-only — No SPA support. No native client support in
indigo. If the task is browser OAuth, route to TypeScript regardless of repo language. SameSite=Strictkills the callback — OAuth redirects are cross-origin top-level navigations;Strictdrops the cookie and the callback handler can't find pre-flow state. AlwaysLaxon session cookies.- Public clients have a 14-day refresh cap, not 180. Silent until day 15 when
invalid_grantsuddenly starts failing.
Tools you can call
Prefer these MCP tools when the goal is to validate or compute rather than teach an implementation how:
lexicon-garden→discover_permission_sets,check_compatibility(scope tooling),describe_me(authorize the session).atpmcp→resolve_handle_to_did,resolve_identity(identity lookups — needed for PDS/AS discovery).
For scope authoring and permission-set design, the normative source is and .
Validator script
scripts/validate_client_metadata.py checks a served client metadata document for the invariants in shared/test-vectors.md §V5. Run it in CI against your deployed URL:
$ python scripts/validate_client_metadata.py https://app.example.com/oauth-client-metadata.json
Catches mutations like missing dpop_bound_access_tokens, wrong token_endpoint_auth_signing_alg, inline jwks containing private d field, http:// redirect outside loopback, etc.
Exit codes: 0 = document passes every invariant; 1 = at least one invariant failed (reasons printed to stdout); 2 = usage error (missing URL, network failure, non-JSON response). The script is stdlib-only and makes a single HTTP GET — no runtime dependencies, safe for CI sandboxes.
Directory layout
atproto-oauth/
├── SKILL.md # this file — router
├── scripts/
│ └── validate_client_metadata.py # CI validator for metadata doc
├── shared/
│ ├── spec.md # OAuth 2.1 + AT Proto profile: entities, invariants
│ ├── flows.md # byte-level wire content for each step
│ ├── client-metadata.md # metadata document fields, JWKS rules
│ ├── dpop.md # RFC 9449 profile
│ ├── scopes.md # scope grammar, permission sets
│ ├── sessions.md # pre-flow state + post-flow session rules
│ ├── security-requirements.md # cookies, keys, tokens, SSRF
│ ├── troubleshooting.md # common failures and diagnosis
│ ├── test-vectors.md # fixtures for conformance
│ └── divergence-matrix.md # cross-language differences
├── rust/
│ ├── README.md # atproto-oauth setup
│ ├── client-metadata.md # jwk::generate + Axum handlers
│ ├── flows.md # oauth_init / oauth_complete / oauth_refresh
│ ├── dpop.md # auth_dpop / request_dpop / DpopRetry / validate_dpop_jwt
│ └── sessions.md # OAuthRequestStorage + custom session abstraction + refresh race
├── typescript/
│ ├── README.md # @atproto/oauth-client-* setup
│ ├── client-metadata.md # client.clientMetadata + client.jwks + JoseKey
│ ├── flows.md # authorize / callback / restore / revoke + BrowserOAuthClient
│ ├── dpop.md # invisible fetchHandler DPoP + per-origin nonce cache
│ └── sessions.md # StateStore / SessionStore / NodeRequestLock + IndexedDB SPA
└── go/
├── README.md # indigo/atproto/auth/oauth setup
├── client-metadata.md # cfg.ClientMetadata() + cfg.PublicJWKS()
├── flows.md # StartAuthFlow / ProcessCallback / ResumeSession / Logout
├── dpop.md # NewAuthDPoP + automatic ClientSession DPoP
└── sessions.md # ClientAuthStore + refresh race (caller-owned)
References
All reachable from the tree above. Listed here for quick grep:
shared/spec.md,shared/flows.md,shared/client-metadata.md,shared/dpop.md,shared/scopes.md,shared/sessions.md,shared/security-requirements.md,shared/troubleshooting.md,shared/test-vectors.md,shared/divergence-matrix.mdrust/README.md,rust/client-metadata.md,rust/flows.md,rust/dpop.md,rust/sessions.mdtypescript/README.md,typescript/client-metadata.md,typescript/flows.md,typescript/dpop.md,typescript/sessions.mdgo/README.md,go/client-metadata.md,go/flows.md,go/dpop.md,go/sessions.md
Upstream normative sources:
- — AT Proto OAuth profile
- — scopes and permission sets
- , , , , , — conceptual guides
- RFC 9449 (DPoP), RFC 7636 (PKCE), RFC 9126 (PAR), RFC 7523 (JWT client auth), RFC 8414 (server metadata), RFC 9207 (
iss), OAuth 2.1 draft
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ngerakines
- Source: ngerakines/atproto-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.