Skip to main content

Get started

This guide will get you up and running with Protekt in under five minutes. By the end, you'll have a working login flow integrated into your application.

Before you begin

You'll need a Protekt account and an active project. If you haven't created one yet:

  1. Sign up at app.protekt.io
  2. Create a new project from your dashboard
  3. Copy your Login ID and API Key from the project settings page

Keep these values handy — you'll need them during setup.

Choose your integration path

Protekt supports multiple integration methods. Pick the one that fits your stack:

MethodBest ForSetup Time
Node.js SDKBackend / server-side apps~3 min
React SDKReact / Next.js frontends~3 min
REST APIAny language or framework~5 min

If you're using a framework not listed above, the REST API works with any HTTP client — no SDK required.

Step 1: Install the SDK

Choose your package manager and install the Protekt SDK for your platform.

Node.js

npm install @protekt/node

React

npm install @protekt/react

Step 2: Configure your project

Create a Protekt client using your project credentials. We recommend storing these in environment variables.

# .env
PROTEKT_LOGIN_ID=lp_7xqm9...
PROTEKT_API_KEY=pk_live_AbCdEfGh...

Node.js project

import { Protekt } from '@protekt/node';

const protekt = new Protekt({
loginId: process.env.PROTEKT_LOGIN_ID,
apiKey: process.env.PROTEKT_API_KEY,
});

React project

import { ProtektProvider } from '@protekt/react';

export default function App() {
return (
<ProtektProvider loginId={process.env.NEXT_PUBLIC_PROTEKT_LOGIN_ID}>
<YourApp />
</ProtektProvider>
);
}

Step 3: Add login to your app

Once configured, adding login is a single function call or component.

Node.js: verify a token on the backend

app.get('/dashboard', async (req, res) => {
const token = req.headers.authorization?.split(' ')[1];
const { user } = await protekt.auth.verifyToken(token);

if (!user) return res.status(401).json({ error: 'Unauthorized' });
res.json({ message: `Welcome, ${user.email}` });
});

React: protect a route

import { useAuth, ProtectedRoute } from '@protekt/react';

function Dashboard() {
const { user } = useAuth();
return <h1>Welcome, {user.email}</h1>;
}

// Wrap any page to require authentication
<ProtectedRoute>
<Dashboard />
</ProtectedRoute>

Step 4: Handle the login redirect

When a user logs in through Protekt's Universal Login page, they are redirected back to your application with a JWT. Configure your redirect URL in the Protekt Dashboard under Project Settings → Redirect URL.

Your app then exchanges this token to establish a session:

// Node.js — handle the redirect
app.get('/auth/callback', async (req, res) => {
const { token } = req.query;
const { user } = await protekt.auth.verifyToken(token);
// Store the token in a session cookie or return it to the client
res.redirect('/dashboard');
});

You're done

That's the core integration. Your application can now authenticate users through Protekt.

From here, you can explore: