Passkin

The signed-in person's side: end-user API and components

Status: built (2026-10-05). Tests: apps/auth-broker/tests/me.test.ts (18), packages/nextjs/tests/sdk.test.ts (16), packages/react/tests/components.test.tsx (17).

After sign-in, a person needs to see and manage their account at your product: their profile, where they are signed in, their organizations, leaving. Clerk ships this as <UserProfile/>, <UserButton/>, <OrganizationSwitcher/>, <OrganizationProfile/>. Passkin ships the same four, drop-in React, English and Arabic, themed with CSS variables — and one decision that is different on purpose.

The decision: credentials live at the Passkin ID, not in your product

A password, a passkey, an authenticator app, a recovery code — in Clerk's <UserProfile/> these are forms inside your page, so a script injected into your site (an XSS bug, a malicious dependency) can reach for them. In Passkin they are not in the product at all: they live at the person's Passkin ID, on its own origin with its own session, CSP and cookie. <UserProfile/> shows them as facts (2 passkeys · password off · authenticator on) with a link to manage them there. The person edits their name and photo once, there too, and every product sees the change. A product cannot read or change a credential, and neither can anything running in it.

The end-user API: /v1/me/…

Authenticated by the access token Passkin issued to the person (Authorization: Bearer …), checked against a live session — a ban or a revoked session ends access at once (not at token expiry). CORS: answered to the project's own sites only. 300 requests a minute per person.

GET /v1/me profile (public and unsafe_metadata, never private_metadata), sign_in_methods, security facts, organizations with role and permissions, manage_account_url, settings (can_create_organizations, can_delete_account)
PATCH /v1/me {unsafe_metadata} — the person's own preferences — and nothing else (name and photo are the Passkin ID's; roles and the rest are yours via the Backend API)
DELETE /v1/me leave the product: {confirm: "<email>"}; ends sessions, removes the account and memberships here; refused (409 last_admin) if they are the only admin of an organization that has other members; switched off with allow_account_deletion: false on the project
GET /v1/me/export their own copy of everything this product holds about them (right of access and portability), as a downloadable JSON file: profile, public and unsafe_metadata, how they sign in, sessions (with IP address and device), organizations and roles, invitations, API keys (never the key), connected accounts (never a token), authorizations and the newest 500 audit entries by or about them. Not the product's private_metadata, and never a password, token or one-time code. Limited to 5 an hour. Recorded as user.data_exported
GET /v1/me/sessions · DELETE /v1/me/sessions/:id · DELETE /v1/me/sessions where they are signed in at this product; end one, or everyone else (back-channel logout is sent to your server)
GET /v1/me/organizations · POST (if the project allows: organizations.allow_user_create, max_per_user)
GET|PATCH|DELETE /v1/me/organizations/:oid needs org:profile:manage (delete: admin + typing the name); private_metadata is never shown
GET …/members · PATCH|DELETE …/members/:uid · POST …/leave org:members:read / org:members:manage; last-admin protection
GET|POST …/invitations · POST …/invitations/:id/revoke org:members:manage; mail is bounded like everywhere
POST …/portal-links {intent: sso|domains|dsync|audit_logs, return_url?} — an organization's own admin sets up single sign-on, domains, directory sync or its audit view through the Admin Portal, with a link for themselves (SSO.md); each intent needs its permission (org:sso:manage, org:domains:manage, org:audit:read)

Permissions are evaluated against the database, not the token (it may be stale), and a person may never hand out, or touch, a role stronger than their own: they can invite or promote only into roles whose permissions they all hold themselves, and cannot change or remove a member whose role holds permissions they lack. An organization you do not belong to is 404, whether or not it exists. Changes are written to the audit log as the person and sent as webhooks.

The Next.js SDK: tokens stay on the server

@passkin/nextjs routes now also serve ${authPath}/api/me/… — a proxy that adds the access token from the encrypted cookie server-side (the browser never holds one), reaches only /v1/me…, and refuses changes that do not come from your own site. POST ${authPath}/organization switches the organization the session acts in (a refresh with organization; the new tokens are sealed back into the cookie), and GET ${authPath}/session now also returns the active organization.

// app/api/auth/[...passkin]/route.ts
import { handlers } from "@/lib/passkin";
export const { GET, POST, PATCH, DELETE } = handlers;

The components: @passkin/react

import { PasskinProvider, UserButton, OrganizationSwitcher, UserProfile, OrganizationProfile } from "@passkin/react";

<PasskinProvider initialUser={user} initialOrganization={organization}>
  <OrganizationSwitcher afterSwitch={() => router.refresh()} />
  <UserButton />                    {/* avatar menu → "Manage account" opens <UserProfile/> in a dialog; sign out */}
</PasskinProvider>
Component
<UserButton lang? returnTo? manage?/> avatar menu; "Manage account" opens the profile dialog
<UserProfile lang? defaultTab?/> Profile · Security (facts + link to the Passkin ID) · Devices (end one / all others) · Your data (download everything the product holds, and — unless the product switched it off — delete the account)
<OrganizationSwitcher lang? afterSwitch?/> the active organization, a menu to switch (or to none), manage, create (when the product allows)
<OrganizationProfile organizationId? lang? onLeft?/> General (name, slug, leave, delete) · Members (roles, remove) · Invitations · Single sign-on (links into the Admin Portal) — each tab appears only if the person has its permission
<CreateOrganization lang? onCreated?/>

Theme with CSS variables on any ancestor: --pk-accent, --pk-bg, --pk-fg, --pk-muted, --pk-line, --pk-danger, --pk-ok, --pk-radius. No stylesheet or script is loaded; lang="ar" flips to right-to-left; dialogs close on Escape and the backdrop and return focus; tabs and menus carry their ARIA roles. A single-page app (no Next.js routes) passes its own api transport — (path, {method, body}) => Promise<json> — to PasskinProvider.

Not built yet

Vue, Svelte and Solid wrappers, a <SignUp/> of your own (sign-in and sign-up are Passkin's hosted pages by design), <OrganizationList/> and a "choose your organization" step on the hosted page for people with several, notification preferences, connected-accounts management inside the product (it is the Passkin ID's), avatar upload (the Passkin ID's), the visual theme editor in the dashboard, and the same API for the iOS/Android SDKs.

API keys

The same components exist as web components for Vue, Svelte, Angular and plain HTML: ELEMENTS.md.

<ConnectedAccounts /> lists the accounts a person has connected to the product (a Google calendar, a GitHub…), offers a button for each provider the developer allows, and disconnects: VAULT.md. Routes: GET/POST /v1/me/connections, DELETE /v1/me/connections/:id; a token is never in them.

<ApiKeys /> (and <ApiKeys organizationId="…" />) lets a person, or an organization's admin, make and revoke the keys that call your API: API-KEYS.md. Routes: GET/POST /v1/me/api-keys, DELETE /v1/me/api-keys/:id.

Ready to try it?

Create a project — the dashboard fills these snippets in with your own keys.

Open the dashboard