/react-native-device-check

Native bridge to the iOS DeviceCheck API

Primary LanguageObjective-CMIT LicenseMIT

react-native-device-check

📱 Native bridge to the iOS DeviceCheck API

Introduction

DeviceCheck helps identify a particular device (per development account) and authenticate a request's origin. Check out the Apple Developer Doc for more detail. This module returns the token in base64 ready for serialization.

The API was introduced in iOS 11 and requires a physical device, running on a lower target or simulator will throw an exception.

Install

npm install @erickcrus/react-native-device-check

Usage

Async/await:

getDeviceToken = async () => {
  try {
    let token = await DeviceCheck.getDeviceToken();
  } catch (error) {
    console.log(error);
  }
}

Promise:

getDeviceToken() {
  DeviceCheck.getDeviceToken().then(token =>
    //
  ).catch(err =>
    console.log(err)
  );
}

License

MIT