NodeJS implementation guide

How to Add Auth to a Node.js App with Magic

View guide

Reference for the Magic Admin SDK for Node.js / server-side JavaScript:


The Magic SDK for server-side JavaScript makes it easy to leverage Decentralized ID Tokens to protect routes and restricted resources for your app. This guide will cover some important topics for getting started with server-side APIs and to make the most of Magic's features.

  • Install the Magic Admin SDK to get started
  • View the API documentation below to learn the methods you'll be using
  • Go to Examples for an introduction to common patterns and use-cases

Looking for a client-side API instead? Check out:

👉 Magic Client SDK for web

👉 Magic Client SDK for React Native



npm install --save @magic-sdk/admin


yarn add @magic-sdk/admin

#Creating an SDK Instance

Examples for the server-side JavaScript SDK use the CommonJS pattern by default.


const { Magic } = require('@magic-sdk/admin');

const mAdmin = new Magic('SECRET_API_KEY'); // ✨

ES Modules/TypeScript

import { Magic } from '@magic-sdk/admin';

const mAdmin = new Magic('SECRET_API_KEY'); // ✨

Did you find what you were looking for?

Did you find what you were looking for?