Skip to content

fazpass/fazpass-intelligence-authentication-react-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fia-react

FIA React Native by Fazpass. Visit official website for more information about the product and see documentation at github documentation for more technical details.

Installation

npm install fia-react

Usage

import FIA, { OtpPromise, OtpAuthType } from 'fia-react';

// initialize
FIA.initialize("MERCHANT_KEY", "MERCHANT_APP_ID");

// request OTP with login purpose
var otpPromise: OtpPromise
FIA.otp().login("PHONE", (promise) => {
    if (promise.hasException) {
        let exception = promise.exception
        // handle exception here
        return
    }
    otpPromise = promise
});

// check OTP authentication type
switch (otpPromise.authType) {
    case OtpAuthType.Message:
        // on message...
        break
    case OtpAuthType.Miscall:
        // on miscall...
        break
    case OtpAuthType.He:
        // on He...
        break
    case OtpAuthType.FIA:
        // on FIA...
        break
};

// validate Message or Miscall OTP
otpPromise.validate(
    "OTP", 
    (err) => {
        // on error
    },
    () => {
        // on validated
    }
);

// validate HE
otpPromise.validateHe(
    (err) => {
        // on error
    },
    () => {
        // on validated
    }
);

License

MIT