FusionAuth Node.js Client Library

The following client library is now deprecated in favor of the typescript client, as it can do everything this project can but with better type support and examples.

Node.js Client Library

The Node.js client library allows you to integrate FusionAuth with your Node application.

Source Code:

NPM Package:

To install the FusionAuth Node Client package run:

$ npm install @fusionauth/node-client

Please note that if you will be using this client library in front end code such as a web browser you will not have a secure way to store an API key. You may optionally pass a value of null for the API key parameter and still make API requests that do not require an API key.

The following code assumes FusionAuth is running on http://localhost:9011 and uses an API key 6b87a398-39f2-4692-927b-13188a81a9a3, you will need to supply your own API key, and if you are not running FusionAuth locally, your host parameter may be different.

Here is an example of using the retrieveUserByEmail method to retrieve a User by an email address.

const {FusionAuthClient} = require('@fusionauth/node-client');
const client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');
{/*  Retrieve User by Email Address */}

function handleResponse (clientResponse) {
  console.info(JSON.stringify(clientResponse.successResponse.user, null, 2));

Example Apps