@authefy/node-client

Authefy SDK for Node.js server.

Getting Started

For more information, check the official github repository.

To Install @authefy/node-client via npm:

$ npm install @authefy/node-client

Instantiate a new Authefy node client:

import Client from '@authefy/node-client';

const authefyNodeClient =  new Client({
    appAccessKey: process.env.AUTHEFY_APP_ACCESS_KEY
});

To create/register a user with a password:

/*
 username - authefy unique username
 password - authefy password 
 email(optional) - user email. If appplication requires email verification,
    it will automatically send email verification link which the user will then
    click and get verified.
 externalId(optional): If the application has different user storage and they want
    to use their own custom id, set this externalId.
*/

await authefyNodeClient.user.create({
  username: 'soaman',
  password: 'pisobr',
  email: 'cu@wuc.hn',
  externalId: '61426833-966e-5d7b-a4d9-ac269a7ac579',
  details: {
     name: 'Kathryn Manning'
  }
});

// returns: User Object

To update users with their id:

To remove/delete users with their id:

To get user information with their id:

To get the list of users:

To get all user events:

To listen to the user event socket:

To authenticate/login user with username and password:

To authenticate/login user with refresh token:

To get the user claims of the authorization bearer token:

To revoke/logout user session with refresh token:

Last updated

Was this helpful?