Status: built (2026-10-05) in packages/react-native (@passkin/react-native). Tested in Node: 12 checks against an in-memory Passkin (forged state, issuer, nonce, audience, expiry; refresh sharing and rotation; outage versus revoked session; native exchange) and 5 against the real broker running in the test process (the hosted page driven by code, real tokens verified with the project's keys, /v1/me, rotation, revocation). Not run on a device or simulator: the three Expo adapters (expo-web-browser, expo-secure-store, expo-crypto) are written from their documented APIs and have never run.
The same protocol as the Swift SDK, packaged for JavaScript apps: Passkin's hosted page in the system's sign-in sheet (ASWebAuthenticationSession on iOS, a Custom Tab on Android), native Sign in with Apple and Google, tokens in secure storage, refresh with rotation, and the end-user API.
Set up
- Dashboard → Applications → Add an iPhone app / an Android app. The redirect URI is your app's own scheme (
com.example.shop:/callback); copy the application's client id. - In
app.json:{ "expo": { "scheme": "com.example.shop" } }. Install:
npx expo install expo-web-browser expo-secure-store expo-crypto
pnpm add @passkin/react-native
import { createPasskin } from "@passkin/react-native";
import { useSession } from "@passkin/react-native/react";
export const passkin = createPasskin({
publishableKey: "pk_live_…",
clientId: "<the application's client id>",
redirectUrl: "com.example.shop:/callback",
});
function Screen() {
const { user, isSignedIn, loading } = useSession(passkin);
if (loading) return null;
return isSignedIn
? <Button title={`Sign out ${user!.email}`} onPress={() => passkin.signOut()} />
: <Button title="Continue with Google" onPress={() => passkin.signIn({ connection: "google" })} />;
}
// A token for your backend, refreshed when it is about to expire (one refresh, however many callers ask at once):
const response = await fetch(api, { headers: { Authorization: `Bearer ${await passkin.accessToken()}` } });
Sign in with Apple natively (expo-apple-authentication; add the capability and turn it on under the application's Native sign-in):
const nonce = await passkin.nativeNonce();
const credential = await AppleAuthentication.signInAsync({ requestedScopes: [FULL_NAME, EMAIL], nonce });
await passkin.signInWithApple({ identityToken: credential.identityToken!, nonce, givenName: credential.fullName?.givenName, familyName: credential.fullName?.familyName });
If it throws a PasskinError with code: "interaction_required" (the person has a second factor, or the project requires one — STEP-UP.md) call passkin.signIn(): the sheet can ask. Google works the same with signInWithGoogle({ idToken, nonce }).
API
createPasskin(config) → signIn(options) · authorizationUrl(options) + handleRedirect(url) (a deep link you receive yourself) · accessToken(minimumValiditySeconds) · refresh() · signOut({ endHostedSession }) · session / user / isSignedIn / issuer · subscribe(listener) · ready (await it before trusting session: the stored one is read asynchronously) · me() · sessions() · revokeSession(id) · signOutOtherSessions() · authorized(path) · nativeNonce() · signInWithApple / signInWithGoogle. Options: connection, loginHint, prompt, maxAge, acrValues: [MULTI_FACTOR], organization, locale, ephemeral. Errors are PasskinError with a stable code: cancelled, not_signed_in, authorization_failed, interaction_required, server (with the OAuth error and HTTP status), invalid_response, storage, network, unavailable.
Behaviour worth knowing
| Sign-in | PKCE S256, state and nonce per sign-in, and the redirect's iss must be the project's (RFC 9207). A wrong state, issuer, nonce, audience or an expired ID token throws invalid_response and stores nothing |
| Discovery | Read from <baseUrl>/p/<pk>/.well-known/openid-configuration, used only if it names the issuer it was fetched for |
| Storage | expo-secure-store (Keychain / Keystore, after first unlock, this device only) when installed. Without it the session is kept in memory and a warning is printed once — a session that does not survive a restart is better known than assumed. Pass storage ({ get, set, delete }) to use anything else |
| Refresh | Simultaneous callers share one refresh; the refresh token is rotated and stored before anyone sees the new access token. invalid_grant drops the session and throws not_signed_in; a network failure keeps it |
| Sign-out | Revokes the refresh token at Passkin (which ends the session) and forgets it here, even offline |
| Your domain | baseUrl: "https://auth.example.com" (CUSTOM-DOMAIN.md) |
| Other runtimes | Everything platform-specific is an adapter: fetch, storage, openAuthSession, crypto. A bare React Native app, Capacitor or Electron passes its own |
Not built
Native passkey calls (needs the Associated Domains / Digital Asset Links for the relying-party id; passkeys already work inside the sheet); Android Credential Manager for Google (use @react-native-google-signin/google-signin and pass its ID token to signInWithGoogle); ready-made sign-in buttons and profile screens; a Flutter SDK; a run on a device; a published release (npm publish is an owner action).