SDK Integration
PowerAuth JS SDK Dependencies
The PowerAuth Mobile JS SDK and the PowerAuth Networking JS SDK are required peer dependencies for the mToken SDK. You must install them in a compatible version.
Defining them as peer dependencies ensures that only a single instance of each SDK is used in your project, preventing issues with multiple npm clones (for example, WPNLoggerConfig settings not applied or instanceof WPNException checks failing).
- For React Native, install
react-native-powerauth-mobile-sdk,react-native-powerauth-networking, andreact-native-mtoken-sdkusingnpmoryarn. - For Cordova, add both
cordova-powerauth-mobile-sdkandcordova-mtoken-sdkusing thecordova plugin addcommand.cordova-mtoken-sdkdeclarescordova-powerauth-mobile-sdkandcordova-powerauth-networkingas plugin dependencies, so compatible plugins are installed if missing, and the installation fails if an incompatible version is already installed.
React Native Installation
Supported Platforms
The library is available for the following React Native (0.87+) platforms:
- Android 7.0 (API 24) and newer
- iOS 15.1 and newer
How To Install
1. Install packages via npm
# if not added yet, add PowerAuth Mobile SDK and PowerAuth Networking SDK first
npm i react-native-powerauth-mobile-sdk --save
npm i react-native-powerauth-networking --save
npm i react-native-mtoken-sdk --save
2. Install pods for iOS (if needed)
To make integration work with iOS, you might need to install Pods (needed for PowerAuth):
cd ios
pod install
3. Import in your js/ts files
import { PowerAuth } from 'react-native-powerauth-mobile-sdk';
function createMtokenInstance() {
const powerAuth = new PowerAuth("my-instance")
// note that an activated PowerAuth instance is required. How to activate the PowerAuth instance, follow https://github.com/wultra/react-native-powerauth-mobile-sdk documentation.
// Then, use PowerAuth's helper function to create the mtoken instance:
const mtoken = powerAuth.createWultraMobileToken()
}
Cordova Installation
Supported Platforms
The library is available for the following Apache Cordova (>=12.0.0) platforms:
- Android 7.0 (API 24) and newer (cordova-android version >=12.0.0)
- iOS 15.0 and newer (cordova-ios version >=7.0.0)
How To Install
1. Install plugins via the Cordova plugin installer
# if not added yet, add PowerAuth Mobile SDK first
cordova plugin add cordova-powerauth-mobile-sdk
cordova plugin add cordova-mtoken-sdk
2. Install pods for iOS (if needed)
To make integration work with iOS, you might need to install Pods (needed for PowerAuth):
cd platforms/ios
pod install
3. Start using Wultra Mobile Token classes
const powerAuth = new PowerAuth("my-instance")
// note that an activated PowerAuth instance is required. How to activate the PowerAuth instance, follow https://github.com/wultra/react-native-powerauth-mobile-sdk documentation.
// Then, use PowerAuth's helper function to create the mtoken instance:
const mtoken = powerAuth.createWultraMobileToken()