expo-otp-retriever
Version:
Expo module for retrieving OTP codes on Android using Google's SMS Retriever API
43 lines (32 loc) • 1.3 kB
Markdown
# Expo OTP Retriever Example
This is a sample application demonstrating how to use the expo-otp-retriever module to automatically detect OTP codes from SMS messages on Android without requiring SMS permissions.
## Features
- Demonstrates OTP retrieval without SMS permissions
- Shows app hash generation
- Handles timeout and error states
- Provides manual OTP input as fallback
- Includes a verification flow
## Running the Example
1. Clone the repository
2. Install dependencies:
```bash
npm install
```
3. Run the example on an Android device:
```bash
npx expo run:android
```
## Testing OTP Detection
To test the OTP detection, you need to send an SMS to the device with the correct format:
1. Get the app hash from the app (displayed on screen)
2. Send an SMS to the device with the following format:
```
<#> Your verification code is: 123456
FA+9qCX9VSu
```
Replace `123456` with your test OTP code and `FA+9qCX9VSu` with the app hash displayed in the app.
3. The app should automatically detect the OTP and display it.
## Important Notes
- OTP retrieval only works on Android devices with Google Play Services installed
- The app hash is different for debug and release builds
- For production apps, you should get your hash from the Google Play Console