FusionAuth Typescript Client

Typescript Client Library

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

Source Code:

NPM Package:

To install the FusionAuth Typescript Client package run:

$ npm install @fusionauth/typescript-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.

import {FusionAuthClient} from 'FusionAuthClient'
const client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');

// Retrieve User by Email Address
client.retrieveUserByEmail('user@example.com')
       .then(handleResponse);

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