Skip to content

NodeJs SDK

You can use this SDK in your ExpressJs applications. And your bots. Also, use it in ReactJs!

Installation

You can install this SDK with NPM.

$ npm i tfa-node-sdk

Writing code

  • After installation you need to require TFA.
// Require TFA class
const tfa = require("tfa-node-sdk");
  • Now define your access token.
// Require TFA class
const tfa = require("tfa-node-sdk");

// Define your access token and initial auth
const auth = new tfa("access_token");
  • Last step, auth user with the user token. Now result have the json object and status code.
// Require TFA class
const tfa = require("tfa-node-sdk");

// Define your access token and initial auth
const auth = new tfa("access_token");

// Authenticate user
const result = auth.authUser("user_token");