React Native


The following guide is a simple example to implement the SDK in your project. This is optional, you can implement the SDK in your project without the example. Remember that you are free to change anything in the example.

To continue with the implementation of the SDK in your project, you must have the React Native CLI installed. If you don't have it installed, you can install it with the following command:

npm install -g react-native-cli

You can to see the official documentation here.

Quick start


Our team has created a simple example available for Android and iOS to facilitate the implementation of the SDK in your project. Request access to the example by sending an email to [email protected].

Autentikar works through of the React Native bridge, so you must have configured the bridge for android and iOS solutions. The bridge is a way to communicate between the native code and the JavaScript code.

Set up


1. JS/TS Configuration

The example shows how to call the plugin in your project:

App.tsx
const onPress = () => {
  console.log('We will invoke the native module here!');

  const params = {
    flowId: 'xxxx',
    country: 'xxxx',
    docType: 'xxxx',
    idNum: 'xxxxx',
  };

  AutentikarBridge.authenticate(params)
    .then(data => {
      console.log(data);
    })
    .catch(error => {
      console.log(error.message);
    });
};
ParameterDescription
flowIdFlow Id of the account.
countryCountry of the user.
docTypeDocument type of the user.
idNumDocument number of the user.

The AutentikarBridge.authenticate method is a promise that returns the data of the instance if the authentication is successful, otherwise it returns an error message. This method works with android and iOS solutions.

2. Android Configuration

To android configuration you mush the following previous guide Android.

To configure the bridge in your project, you must create a new file in the android/app/src/main/java/com/yourprojectname/ directory. The example provides two files to configure the bridge. Then you must add the package to the MainApplication file:

MainApplication.java

@Override
protected List<ReactPackage> getPackages() {
    @SuppressWarnings("UnnecessaryLocalVariable")
    List<ReactPackage> packages = new PackageList(this).getPackages();
    packages.add(new RNReactNativeBridgePackage());
    return packages;
 }

3. iOS Configuration

To iOS configuration you mush the following previous guide iOS.

The bridge are implemented in Swift and Objective-C languages.

Modify the AutentikarBridgeViewController.swift class with your own code.

Response

For obtain the result of the SDK in your JS/TS code you can to implement code in the promise of the AutentikarBridge.authenticate method.