PasskeyBase

Quick Start

Add passkey authentication to your app in under five minutes.

Prefer a runnable application? Try and download the Node.js, React, Go and ASP.NET quickstarts →


1. Sign up for PasskeyBase

Create a free account at manage.passkeybase.com. No credit card required.

2. Create a tenant

From the dashboard, create a new tenant. Choose a subdomain (e.g., myapp) and you'll get a domain like myapp.auth.ing.

3. Create an OAuth application

In the tenant settings, create a new OAuth application. Set the redirect URI to your app's callback URL (e.g., http://localhost:3000/callback). Copy the Client ID -- you'll need it in the next step.

4. Install the SDK

Terminal
npm install @passkeybase/js

Then initialize the SDK with your client ID and domain:

app.js
import { PasskeyBase } from '@passkeybase/js';

const pb = new PasskeyBase({
  clientId: 'pk_live_abc123',        // from dashboard
  domain: 'myapp.auth.ing',          // your tenant domain
  redirectUri: window.location.origin + '/callback',
});

5. Add a login button

Call loginWithRedirect() to send users to your hosted login page. They'll authenticate with a passkey and be redirected back.

index.html
<!-- Add a login button to your page -->
<button id="login-btn">Log in with Passkey</button>

<script>
  document.getElementById('login-btn')
    .addEventListener('click', () => {
      pb.loginWithRedirect();
    });
</script>

6. Handle the callback

After authentication, the user is redirected to your redirectUriwith an authorization code. The SDK exchanges this for tokens automatically.

callback.js
// In your callback page (e.g., /callback)
import { PasskeyBase } from '@passkeybase/js';

const pb = new PasskeyBase({
  clientId: 'pk_live_abc123',
  domain: 'myapp.auth.ing',
  redirectUri: window.location.origin + '/callback',
});

async function handleCallback() {
  try {
    const result = await pb.handleRedirectCallback();
    // Tokens stay in SDK memory. Render your authenticated UI here.
    // A full page reload intentionally clears this SPA session.
    renderSignedInView(result.user);
  } catch (err) {
    console.error('Auth failed:', err);
  }
}

handleCallback();

Next steps