Node
Node
NodeJS implementation guide
How to Add Auth to a Node.js App with Magic
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
Looking for a client-side API instead? Check out:
#Installation
NPM
01npm install --save @magic-sdk/admin
Yarn
01yarn add @magic-sdk/admin
#Creating an SDK Instance
Examples for the server-side JavaScript SDK use the CommonJS pattern by default.
CommonJs
01const { Magic } = require('@magic-sdk/admin');
02
03const mAdmin = new Magic('SECRET_API_KEY'); // ✨
ES Modules/TypeScript
01import { Magic } from '@magic-sdk/admin';
02
03const mAdmin = new Magic('SECRET_API_KEY'); // ✨