Skip to content

tru-ID/firebase-phone-auth-sim-swap-detection-react-native

Repository files navigation

Adding SIM Swap Detection to your React Native Firebase Apps with Firebase Auth & tru.ID SIMCheck

Requirements

  • A tru.ID Account
  • A Firebase Account
  • An Android / Apple Phone with a SIM card and mobile data connection
  • For iOS: Require XCode >12
  • For Android:
  • For metro bundler, require node version > 10

Getting Started

Clone the starter-files branch via:

git clone -b starter-files --single-branch https://github.com/tru-ID/firebase-phone-auth-sim-swap-detection.git

If you're only interested in the finished code in main then run:

git clone -b main --single-branch https://github.com/tru-ID/firebase-phone-auth-sim-swap-detection.git

To restore dependencies, open a new terminal and run:

npm install

Create a tru.ID Account

Install the tru.ID CLI via:

npm i -g @tru_id/cli

Input your tru.ID credentials which can be found within the tru.ID console

Install the tru.ID CLI development server plugin

Create a new tru.ID project within the root directory via:

tru projects:create rn-firebase-auth

Run the development server, pointing it to the directly containing the newly created project configuration. This will also open up a localtunnel to your development server making it publicly accessible to the Internet so that your mobile phone can access it when only connected to mobile data.

tru server -t --project-dir ./rn-firebase-auth

Setting up React Firebase Auth

This project uses React Native Firebase, So, first install both the app and auth dependencies:

npm install --save @react-native-firebase/app @react-native-firebase/auth

Then follow the guides within the offical documentation:

Starting Project

To start the project, ensure you have a physical device connected (see Running React Native on a physical device guide ) then run:

npm run android
#or
npm run ios

Troubleshooting

While trying to run on Android, you might run into Could not find or load main class org.gradle.wrapper.GradleWrapperMain error. To resolve it:

  • Install Gradle
  • Navigate to the Android directory and run gradle wrapper
  • Run npm run android

References

Meta

Distributed under the MIT License. See LICENSE

tru.ID