I’m writing an app in React-Native and need some help concerning identifying the device after reinstalling the application.
What I need:
The closest to this I’ve come over is the getUniqueID()
method in react-native-device-info. However, a different ID will be returned on iOS if the app is reinstalled since the returned value for this method is related to the vendor.
Have a great day!
When using iOS, you can take this token, and set up two bits on a server hosted directly in Apple by using your own server as a middle-man (as you should not do it directly, from the mobile app).
According to Apple: Apple records the bits for you and reports the bits back to you, but you’re responsible for keeping track of what the bits mean. You’re also responsible for determining when to reset the bits for a given device; for example, when a user sells the device to someone else
Similarly, with Android - you just send attestation from device to server where it will be validated.
To use mentioned libs in React Native, you can either install corresponding libs:
or if you are using Firebase libs (e.g. from rnfirebase.io), you can use AppCheck that uses SafetyNet and DeviceCheck / App Attestation underhood and comes also with easy server-side verification (also for non-Firebase resources).
Libs:
As this token can change over time (by design), you should implement few services that support that / or potentially re-architect your app. Typically, tokens are stored under the user profile in your backend (or they are linked in some other way to the user that is using the device in the given time).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With