Recommended pattern
1
Create a verification
Start the flow from your server and attach
customerUserRef to link it to your user.2
Confirm the result server-side
Process a webhook or fetch
verifications.getResult(verificationId).3
Store a verified flag
Write the minimum state you need to your user, membership, or session table.
4
Check that state in middleware
Protect pages with your framework middleware or route guards.
Next.js middleware
Import middleware from@authbound/nextjs/middleware, not from the package root. The root export exists for compatibility, but the dedicated middleware entry keeps Edge bundles smaller.
Next.js 16 renamed
middleware.ts to proxy.ts. On Next.js 16, put the same code in proxy.ts; the default export and config work unchanged.withAuthbound when you want SDK route matching and redirects, but keep the verification decision tied to your own session model.
middleware.ts