React Native plugin installation
Prerequisites
Your existing React Native application project has to meet the following prerequisites:
- iOS 12.4 or later
- Xcode 14.x, including Swift 5.7
- Android 6 or later, with API level 23
- Android 10 or later, with API level 29, for the biometric authenticator to work
- Android 11 or later, with API level 30, for the device passcode authenticator to work
- Gradle 7.4 or later
- Android Gradle Plugin
com.android.tools.build:gradle
7.4.2 or later - Kotlin Gradle Plugin
org.jetbrains.kotlin:kotlin-gradle-plugin
1.8.21 or later - React Native 0.72.x
Yarn
To integrate Nevis Mobile Authentication SDK React Native plugin into your React Native project execute this command:
yarn add @nevissecurity/[email protected]
This will also update your package.json
and your yarn.lock
so that other developers working on the project will get the same dependencies as you when they run yarn
or yarn install
.
Platform specific installation notes
Android
To install Nevis Mobile Authentication Client SDK for Android into your application follow the instructions of Android installation guide, the steps written have to be applied to the Android application part of your React Native project (e.g.: YOUR_REACT_NATIVE_PROJECT_PATH/android
).
After the basic Android installation follow next chapters for React Native specific instructions.
Gradle properties configuration
Add the following to your android/gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false
shrink=false
Dependency configuration
Declare Nevis Mobile Authentication Client SDK as a dependency in your android/app/build.gradle
file. For React Native projects it is strongly recommended to declare these dependencies using dynamic versions.
dependencies {
//noinspection GradleDynamicVersion
debugImplementation 'ch.nevis:nevis-mobile-authentication-sdk-android-debug:3.5.+'
//noinspection GradleDynamicVersion
releaseImplementation 'ch.nevis:nevis-mobile-authentication-sdk-android:3.5.+'
}
iOS
Dependency configuration
To integrate Nevis Mobile Authentication Client SDK for iOS into your React Native application using CocoaPods, specify it in your ios/Podfile
:
pod 'NevisMobileAuthentication', :configurations => ['Release']
pod 'NevisMobileAuthentication-Debug', :configurations => ['Debug']
Bitcode support
As the native iOS SDK does not provide Bitcode support, the following post install step needs to be added to the Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO' # NMA SDK does not support Bitcode
end
end
end
Then execute pod install with update.
pod install --repo-update
Enable Face Recognition
Modify your applications Info.plist
file (located under ios) to add a description for the NSFaceIDUsageDescription
key to use the Face Recognition authenticator. Ideally, this value should be localized.
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you to use the Face Recognition authenticator.</string>