Skip to main content

Setting up your backend

Privy provides a server-auth SDK for managing your users and their authentication data from a Node.js server. You can use this SDK to validate auth tokens issued by Privy, get user data, delete users, and more.

info

Not using Node in your backend? Check out our REST API reference!

Installation

Install the Privy Server Auth SDK with npm:

npm i @privy-io/server-auth

Initializing your backend client

Next, import the PrivyClient from the SDK and initialize it with your Privy app ID and app secret. You can retrieve your app ID and app secret from the 'API Keys' page for your app in the Privy console.

Initializing your backend Privy client
import { PrivyClient } from '@privy-io/server-auth';

const privy = new PrivyClient(<your-app-id>, <your-app-secret>);

You can now use the PrivyClient to access Privy from your backend!

caution

Keep your app secret safe. It enables you to update your app configurations, fetch users data, and delete users from your app.

Privy does not store your app secret.