This guide walks you through replacing a standard NextAuth.js setup with Solidus credential-based authentication. We'll go from zero to a working integration in just a few steps.
Prerequisites: Node.js 18+, a Next.js 14+ project, a Solidus API key from docs.solidus.network.
Step 1: Install the SDK.
npm install @solidus-network/sdkStep 2: Initialize the client. Create `lib/solidus.ts`:
import { SolidusClient } from '@solidus-network/sdk'
export const solidus = new SolidusClient({
apiKey: process.env.SOLIDUS_API_KEY!,
mode: process.env.NODE_ENV === 'production' ? 'live' : 'sandbox',
})Step 3: Create a verification API route at `app/api/verify/route.ts`. The route accepts a credential presentation, validates the signature against the on-chain DID document, and returns the verified claims.
Step 4: Add the verification flow to your sign-up/sign-in component. Users with an existing Solidus credential click once to present it. New users are redirected to the KYC flow.
Step 5: Configure your middleware to check for a valid session credential on protected routes.
The full integration — including error handling, session management, and webhook setup for credential revocation events — is covered in the complete guide at docs.solidus.network.
Ready to integrate?
Replace your legacy auth provider today. Get 1,000 free verifications per month, no credit card required.
Keep Reading
View all articles →Join the Solidus Research Lab
Get weekly technical articles, protocol updates, and industry analysis delivered straight to your inbox.
No spam. Unsubscribe anytime. Read our Privacy Policy.