Handles OAuth2 PKCE authentication with Confidence via Auth0.
Flow
Check existing credentials — Look for persisted token at $TMPDIR/confidence_token. Validate JWT expiry.
Prompt user — If valid token exists, offer to reuse or re-authenticate. If no token, ask whether to create a new account or sign in.
Browser-based OAuth2 PKCE — Start local HTTP server on port 8084, open browser to Auth0 authorize endpoint, wait for callback with authorization code.
Token exchange — Exchange authorization code + PKCE verifier for access token and refresh token.
Persist tokens — Write access token to $TMPDIR/confidence_token, refresh token to $TMPDIR/confidence_refresh_token, and the Auth0 organization (org_id claim, falling back to https://confidence.dev/org_login_id) to $TMPDIR/confidence_organization.
Extract region — Decode JWT payload, read https://confidence.dev/region claim (EU or US) to determine regional API endpoints.
Auth0 Configuration
Parameter
Value
Domain
auth.confidence.dev
Audience
https://confidence.dev/
Scope
openid profile email offline_access
Client ID (signup)
82qMvwZvqd3t3S0gRDvs8R53TehQXSJY
Client ID (login)
2fG3H4RhlAbIZm9Rfn32zTaILH7w1X4w
Callback port
8084
Callback path
/callback
Constraints
Never expose tokens, org IDs, JWT claims, or auth internals to the user.
Port 8084 is fixed — kill any existing process on that port before starting the auth server.
Token validation must check JWT expiry before each API call. Re-authenticate if expired.
Regional endpoints are derived from the JWT region claim: {service}.{eu|us}.confidence.dev (flags, iam, resolver).
PKCE is required — use S256 code challenge method with crypto-random verifier.
All auth errors must be presented as plain-English messages, never raw API errors.
Implementation
The auth flow is implemented in src/lib/auth.ts using Node.js built-ins:
node:crypto for PKCE code verifier/challenge generation
node:http for local callback server
child_process.exec for opening the browser (platform-aware)
Auth0 organization for skipping the workspace prompt on login
Remembered Workspace
On interactive login (never signup), the remembered organization is passed as the organization parameter to the Auth0 authorize endpoint so the workspace prompt is skipped. The CONFIDENCE_ORGANIZATION env var overrides the remembered value. If Auth0 returns an error on the callback while an organization was passed, the flow retries once without the organization parameter instead of failing.
1---2name: wizard-auth3description: Authentication Skill4---5# Authentication Skill67Handles OAuth2 PKCE authentication with Confidence via Auth0.89## Flow10111. **Check existing credentials** — Look for persisted token at `$TMPDIR/confidence_token`. Validate JWT expiry.122. **Prompt user** — If valid token exists, offer to reuse or re-authenticate. If no token, ask whether to create a new account or sign in.133. **Browser-based OAuth2 PKCE** — Start local HTTP server on port 8084, open browser to Auth0 authorize endpoint, wait for callback with authorization code.144. **Token exchange** — Exchange authorization code + PKCE verifier for access token and refresh token.155. **Persist tokens** — Write access token to `$TMPDIR/confidence_token`, refresh token to `$TMPDIR/confidence_refresh_token`, and the Auth0 organization (`org_id` claim, falling back to `https://confidence.dev/org_login_id`) to `$TMPDIR/confidence_organization`.166. **Extract region** — Decode JWT payload, read `https://confidence.dev/region` claim (EU or US) to determine regional API endpoints.1718## Auth0 Configuration1920| Parameter | Value |21| ------------------ | ------------------------------------- |22| Domain | `auth.confidence.dev` |23| Audience | `https://confidence.dev/` |24| Scope | `openid profile email offline_access` |25| Client ID (signup) | `82qMvwZvqd3t3S0gRDvs8R53TehQXSJY` |26| Client ID (login) | `2fG3H4RhlAbIZm9Rfn32zTaILH7w1X4w` |27| Callback port | `8084` |28| Callback path | `/callback` |2930## Constraints3132- **Never expose tokens, org IDs, JWT claims, or auth internals** to the user.33- **Port 8084** is fixed — kill any existing process on that port before starting the auth server.34- **Token validation** must check JWT expiry before each API call. Re-authenticate if expired.35- **Regional endpoints** are derived from the JWT region claim: `{service}.{eu|us}.confidence.dev` (flags, iam, resolver).36- **PKCE is required** — use S256 code challenge method with crypto-random verifier.37- All auth errors must be presented as plain-English messages, never raw API errors.3839## Implementation4041The auth flow is implemented in `src/lib/auth.ts` using Node.js built-ins:4243- `node:crypto` for PKCE code verifier/challenge generation44- `node:http` for local callback server45- `child_process.exec` for opening the browser (platform-aware)46- `fetch` for token exchange with Auth047- JWT payload decoded manually (base64url) — no external JWT library needed4849## Token Files5051| File | Content |52| ---------------------------------- | ------------------------------------------------------------- |53| `$TMPDIR/confidence_token` | JWT access token |54| `$TMPDIR/confidence_refresh_token` | Refresh token for silent re-auth |55| `$TMPDIR/confidence_organization` | Auth0 organization for skipping the workspace prompt on login |5657## Remembered Workspace5859On interactive **login** (never signup), the remembered organization is passed as the `organization` parameter to the Auth0 authorize endpoint so the workspace prompt is skipped. The `CONFIDENCE_ORGANIZATION` env var overrides the remembered value. If Auth0 returns an error on the callback while an organization was passed, the flow retries once without the `organization` parameter instead of failing.
Run npx skillmds@latest add spotify/wizard-auth in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Authentication Skill It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
spotify (@spotify) published this skill. Their other Agent Skills are listed on their SkillMD profile.