Add a new Trusted Device
Steps
There are 2 steps that's needed to add a new Trusted Device:
Check if this device is a Trusted Device
Show the QR Code of the New Non-Trusted Device
Scan the New Device's QR Code using the Trusted Device
Step 1: Check if this device is a Trusted Device
componentDidMount() {
var cotter = new Cotter(
API_KEY_ID,
userID,
);
this.cotter = cotter;
this.checkIfThisDeviceTrusted();
}
checkIfThisDeviceTrusted = () => {
this.cotter.trustedDevice
.trustedDeviceEnrolled()
.then(trusted => {
// trusted = True or False
this.setState({trusted: trusted});
})
.catch(err => console.log(err));
};Step 2: Show the QR Code of the New Device
To show the QR Code of the new device:
This will open a modal with a QR Code that can be scanned from the Trusted Device.
Step 3: Scan the QR Code from a Trusted Device
Setup Permission to Allow Camera
Update your Info.plist in ios/YourProject/Info.plist
Android
Add the permission below to your app android/app/src/main/AndroidManifest.xml file:
If you get the error "Cannot choose between the following variants of project :react-native-camera":
Add the following to yourandroid/app/build.gradle
If you get the error "Execution failed for task ':app:mergeDexDebug'"
Add the following to yourandroid/app/build.gradle
Scan the QR Code
To open the Scanner modal:
This will open a modal where the user can scan the QR Code displayed on the new device.
If you encounter the error Invalid RNPermission X. Should be one of: ()
Clean up Xcode stale data with
npx react-native-clean-project --remove-iOS-build --remove-iOS-pods
Last updated