Node

Node

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: https://github.com/magiclabs/magic-admin-js

#Overview

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
note

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

👉 Magic Client SDK for web

👉 Magic Client SDK for React Native

#Installation

NPM

Bash
01npm install --save @magic-sdk/admin

Yarn

Bash
01yarn add @magic-sdk/admin

#Creating an SDK Instance

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

CommonJs

Typescript
01const { Magic } = require('@magic-sdk/admin');
02
03const mAdmin = new Magic('SECRET_API_KEY'); // ✨

ES Modules/TypeScript

Typescript
01import { Magic } from '@magic-sdk/admin';
02
03const mAdmin = new Magic('SECRET_API_KEY'); // ✨

Did you find what you were looking for?

Did you find what you were looking for?