You’ll add a /verify page to your app. It shows a QR code, the user scans it with their digital identity wallet, and once the wallet proves who they are, the page shows your content.

Before you start

1

Install the SDK

pnpm add @authbound/nextjs
2

Add your keys

.env.local
AUTHBOUND_SECRET_KEY=sk_test_...
AUTHBOUND_SESSION_SECRET=...
NEXT_PUBLIC_AUTHBOUND_PK=pk_test_...
NEXT_PUBLIC_AUTHBOUND_POLICY_ID=pol_kyc_basic_authbound_v1
Generate the session secret with openssl rand -base64 32. The SDK uses it to encrypt its session cookie.pol_kyc_basic_authbound_v1 is a built-in policy that asks the wallet for the user’s name, date of birth and nationality, and confirms they’re over 18. You can swap it for another preset or your own policy later.
3

Add the API route

This one route handles everything the browser needs from your server: starting a verification, checking its status, and setting a session cookie when it succeeds. Your secret key never leaves the server.
app/api/authbound/[[...authbound]]/route.ts
import { createAuthboundHandlers } from "@authbound/nextjs/server";

export const { GET, POST, DELETE } = createAuthboundHandlers({
  apiKey: process.env.AUTHBOUND_SECRET_KEY!,
  publishableKey: process.env.NEXT_PUBLIC_AUTHBOUND_PK!,
  secret: process.env.AUTHBOUND_SESSION_SECRET!,
  routes: {
    protected: [],
    verify: "/verify",
  },
});
4

Wrap your app in the provider

The provider is a client component, so it goes in its own file.
app/authbound-provider.tsx
"use client";

import { asPolicyId, AuthboundProvider } from "@authbound/nextjs/client";
import type { ReactNode } from "react";

const policyId = asPolicyId(process.env.NEXT_PUBLIC_AUTHBOUND_POLICY_ID!);

export function AuthboundProviders({ children }: { children: ReactNode }) {
  return (
    <AuthboundProvider
      publishableKey={process.env.NEXT_PUBLIC_AUTHBOUND_PK!}
      policyId={policyId}
    >
      {children}
    </AuthboundProvider>
  );
}
Then use it in your root layout, along with the SDK’s styles.
app/layout.tsx
import "@authbound/nextjs/styles.css";
import type { ReactNode } from "react";
import { AuthboundProviders } from "./authbound-provider";

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="en">
      <body>
        <AuthboundProviders>{children}</AuthboundProviders>
      </body>
    </html>
  );
}
5

Add the verify page

VerificationWall shows a start button, then the QR code, then its children once the user is verified. It uses the policy you set on the provider.
app/verify/page.tsx
"use client";

import { VerificationWall } from "@authbound/nextjs/client";

export default function VerifyPage() {
  return (
    <VerificationWall
      title="Verify your identity"
      description="Scan the QR code with your wallet app."
    >
      <h1>You're verified</h1>
    </VerificationWall>
  );
}

Try it

Run pnpm dev, open localhost:3000/verify and click Start Verification. Scan the QR code with your wallet and approve the request. The page switches to “You’re verified”. On a phone, the page also shows a button that opens the wallet on the same device.

What just happened

Your server asked Authbound to start a verification, and the browser showed the wallet handoff. The wallet sent its proof to Authbound, not to your app. Authbound checked it against the policy, and the browser saw the result. The browser result is good enough to update the page, but not to grant access to anything that matters. For that, your server needs to confirm the result itself. How it works explains why.

Next steps

Receive webhooks

Confirm results on your server before you grant access.

Protect routes

Send unverified users to /verify automatically.

Configure for production

Proxies, allowed origins, session modes and EUDI options.