Skip to main content

API Reference - React Native

Create an SDK Instance#

import RNLoginApi from 'react-native-fido-login-api';
export default class App extends React.Component{
async componentDidMount(){
// clientId example 032690b3-9bc4-4602-87c1-60c1fae782f2
const clientId = "<your client id>";
// baseURL example https://060ce487-b934-43d0-a925-b66e80c7532f.<base_url>
const baseURL = "<your base url>";
RNLoginApi.configure(clientId,baseURL);
//...
//...
}
}

registerWithFido2#

Sign up a user for FIDO authentication.

static async registerWithFido2(username:string, options: RegistrationOptions | null) : Promise<RegisterResponse>

Where:

export interface RegistrationOptions {
authorization_token: string,
}
ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be registered.
optionsRegistrationOptionsoptionalAPI Service token (JWT) signed by your Private Key, as per the API Credential added to the integration.

registerWithPassword#

Creates a user account with a password (not recommended). If leveraging this method, users should be migrating to use a FIDO authenticator, then have their password revoked.

static async registerWithPassword(username:string, password: string, confirmPassword:string, options: RegistrationOptions | null) : Promise<RegisterResponse>

Where:

export interface RegistrationOptions {
authorization_token: string,
}
ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be registered.
passwordstringtruePassword of the customer to be registered.
passwordConfirmationstringtrueIt is best practice to have the customer enter their password twice before creating their profile to prevent typos. If desired, you could only require the end user to enter their password once and pass that password in both fields.
optionsRegistrationOptionsoptionalAPI Service token (JWT) signed by your Private Key, as per the API Credential added to the integration.

authenticateWithFido2#

Authenticate a previously registered user through FIDO2.

static async authenticateWithFido2(username:string, options: AuthenticationOptions | null) : Promise<AuthenticateResponse>

Where:

export interface AuthenticationOptions {
authorization_token: string,
}
ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be registered.
optionsAuthenticationOptionsoptionalAPI Service token (JWT) signed by your Private Key, as per the API Credential added to the integration.

authenticateWithPassword#

Authenticate a previously registered user using username and password.

static async authenticateWithPassword(username:string, password:string, options: AuthenticationOptions | null) : Promise<AuthenticateResponse>

Where:

export interface AuthenticationOptions {
authorization_token: string,
}
ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be authenticated.
passwordstringtruePassword of the customer to be authenticated.
optionsAuthenticationOptionsoptionalAPI Service token (JWT) signed by your Private Key, as per the API Credential added to the integration.

confirmTransaction#

Confirm the transaction of a text-based payload using registered Fido2 account.

static async transactionConfirmation(username:string, payload: TransactionPayload, options:TransactionOptions | null) : Promise<AuthenticateResponse>

Where:

export interface TransactionPayload {
nonce: string,
data: string,
}
export interface TransactionOptions {
authorization_token: string,
}
ParameterTypeRequiredDetails
usernamestringtrueUsername of the customer to be authenticated.
payloadTransactionPayloadtrueRequire a client side generated nonce value and a text message to display back to user for confirmation.
optionsAuthenticationOptionsoptionalAPI Service token (JWT) signed by your Private Key, as per the API Credential added to the integration.

isLoggedIn#

Check if a given user is currently logged in.

logout#

Deprecated Methods#

The SDK previously had the following methods:

  • .register()
  • .login()

The methods have been deprecated, as the type of authenticator is now specified in the register and authenticate methods.