Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magiclabs/magic-admin-js
Magic admin Node.js SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
https://github.com/magiclabs/magic-admin-js
authentication identity jamstack javascript nodejs passwordless
Last synced: 6 days ago
JSON representation
Magic admin Node.js SDK makes it easy to leverage Decentralized ID tokens to protect routes and restricted resources for your application.
- Host: GitHub
- URL: https://github.com/magiclabs/magic-admin-js
- Owner: magiclabs
- License: mit
- Created: 2020-02-19T23:52:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T16:00:57.000Z (7 months ago)
- Last Synced: 2024-05-02T16:55:14.725Z (6 months ago)
- Topics: authentication, identity, jamstack, javascript, nodejs, passwordless
- Language: TypeScript
- Homepage: https://docs.magic.link/admin-sdk/node-js
- Size: 595 KB
- Stars: 74
- Watchers: 22
- Forks: 32
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Magic Authentication Admin Javascript SDK
[![Publish](https://github.com/magiclabs/magic-admin-js/actions/workflows/publish.yml/badge.svg?branch=master)](https://github.com/magiclabs/magic-admin-js/actions/workflows/publish.yml)
> The Magic Admin SDK lets developers secure endpoints, manage users, and create middlewares via easy-to-use utilities.
License ยท
Changelog ยท
Contributing Guide## ๐ Documentation
See the [developer documentation](https://magic.link/docs/api-reference/server-side-sdks/node) to learn how you can master the Magic Admin SDK in a matter of minutes.
## ๐ Installation
Integrating your Node.js application with Magic will require our server-side NPM package:
```bash
# Via NPM:
npm install --save @magic-sdk/admin# Via Yarn:
yarn add @magic-sdk/admin
```## โก๏ธ Quick Start
Sign up or log in to the [developer dashboard](https://dashboard.magic.link) to receive API keys that will allow your application to interact with Magic's administration APIs.
```ts
const { Magic } = require('@magic-sdk/admin');// In async function:
const magic = await Magic.init('YOUR_SECRET_API_KEY');
// OR
Magic.init('YOUR_SECRET_API_KEY').then((magic) => {
magic
});
// Validate a token
try {
magic.token.validate("DIDToken");
} catch (e) {
console.log(e);
}
// Magic Auth - Get User Email
try {
await magic.users.getMetadataByToken("DIDToken");
} catch (e) {
console.log(e);
}
```