Skip to main content

Setup your account

Before you begin, make sure you have a TruSec account. If you don’t have one yet, sign up for free.
1

Get your API keys

Navigate to your Dashboard Settings to retrieve your API keys.You’ll need:
  • Public Key: Used for client-side integrations
  • Secret Key: Used for server-side API calls (keep this secure!)
2

Install the SDK

Choose your preferred language and install the TruSec SDK:
npm install @trusec/sdk
3

Initialize TruSec

Configure the SDK with your API key:
import { TruSec } from '@trusec/sdk';

const trusec = new TruSec({
  apiKey: process.env.TRUSEC_SECRET_KEY,
});
4

Authenticate a user

Use TruSec to authenticate users in your application:
// Verify a user's session
const session = await trusec.sessions.verify({
  token: userToken,
});

if (session.valid) {
  console.log('User authenticated:', session.user);
}

Next steps