Node.js Admin SDK

Installation

npm install --save @authembed/admin
# or
yarn add @authembed/admin

Usage

import { AuthembedAdminSDK, AuthembedUser } from '@authembed/admin';

const authembedAdminSdk = new AuthembedAdminSDK({
    url: 'https://authembed.example.com',
    username: 'main_backend',
    password: '...',
});

// ...

const user: AuthembedUser = await authembedAdminSdk.getUserByToken(request.headers.authorization);

console.log(user);
// { _id: '...', name: 'John Doe', email: 'john@example.com', ... }

Get users by IDs

Update a user

Usage with Nest.js framework

The SDK also has built in support for Nest.js framework.

Last updated

Was this helpful?