- About
- Dependencies
- Requirements
- Documentation
- Installation
- Running the Sample App
- Running the Sample Backend
- Using the Sample App
- Errors
- Contributing
- License
Twilio Silent Network Auth will protect you against account takeovers (ATOs) that target your user's phone number by streamlining your methods for verifying mobile number possession. Instead of sending one-time passcodes (OTPs) that can be stolen or forcing users to implement complicated app-based solutions, Twilio Silent Network Auth will verify mobile number possession directly on the device by using its built-in connectivity to the mobile operators’ wireless network.
This SDK will help you with process the SNA URL's provided by our Verify services to silently validate a phone number.
See Silent Network Auth Overview
None
- Android Studio Dolphin | 2021.3.1 or higher
- Java 8
- Android SDK 21 or higher
- Gradle 7.2
- Kotlin 1.6
Offical documentation will be added via Twilio docs once this project gets released.
Important note:
We are working on having the Twilio Verify SNA SDK artifact available in a repository manager soon.
Currently, it's possible to include the aar of the SDK including it as external package following the next steps:
- Clone the repo and open it in Android Studio.
- Generate the SDK aar file by building the project. The built file is located in:
/verify_sna/build/outputs/aar/
- Put the aar file in
libsfolder of your app project (create the folder if it doesn't exist). - On your app, in the project-level
build.gradlefile:
allprojects {
// ...
repositories {
// ...
flatDir {
dirs 'libs'
}
}
}
- In the app-level
build.gradlefile add:
dependencies {
// ...
implementation (name:'aar-name', ext:'aar')
}
For running the demo you will need to create a sample backend, this backend will communicate with the Twilio Verify Services and provide to the client a SNA URL that this SDK will use to validate across the carrier cellular network.
Important note:
The demo app needs to run on a real device with a working SIM-CARD and internet connection (provided by the sim-card, not Wi-Fi).
Currently it's not possible to test the functionality using a virtual device.
To run the sample app:
- Clone the repo.
- Open it in Android Studio.
- Select
samplein the run/debug configuration selector. - Connect or prepare your test device with developer options enabled.
- Click Run button.
- Configure a Verify Service.
- Go to: Verify SNA Sample Backend
- Use the
Quick Deploy to Twiliooption- You should log in to your Twilio account.
- Enter the
Account Sid,Auth Token,Verify Service Sid,Sync Service SidandSync Map Sidyou created above.- Create
Sync Map Sidby clicking on the Service > Maps tab and click theCreate new Sync Mapbutton in the top right. Once created, copy the Sid.
- Create
- Deploy the application.
- Press
Go to live application. - You will see the start page. You can check for SNA transactions there, using the
Fetch transactionsbutton. - Copy the url and remove
index.html, e.g.verify-sna-xxxx.twil.io. This will be thesample backend URLto use in the sample app.
To validate a phone number:
- Set the phone number.
- Available carriers during this phase:
- US: Verizon, TMO.
- UK: EE, Vodafone, O2 and ThreeUK.
- CA: Bell, Rogers and Telus.
- Available carriers during this phase:
- Set the country code (only US during pilot stage).
- Set your sample backend URL.
- Submit the form by using the CTA button.
Expected behavior: The app will ask the network carrier if the provided phone number is the same used on the network request, if the phone number is correct, then the app will redirect to a success screen.
| Name | Description | Technical cause |
|---|---|---|
| InvalidUrlException | Invalid url, please check the format. | Unable to convert the url string to an URL struct. |
| CellularNetworkNotAvailable | Cellular network not available | Cellular network not available, check if the device has cellular internet connection or you are not using a simulator or tablet. |
| NoResultFromUrl | Unable to get a valid result from the requested URL. | Unable to get a redirection path or a result path from the url, probably the SNA URL is corrupted (or maybe expired) |
| NetworkRequestException | Error processing the network request. | An error was thrown in the network layer, check the inner exception property for more details. |
| RunInMainThreadException | The SDK detected it was running in the main thread. | The SDK is performing long-time tasks that can freeze or stop the app, it's required to run the SDK in a background thread. |
| UnexpectedException | An unknown error was thrown. | Check the inner exception for more details. |
This project welcomes contributions. Please check out our Contributing guide to learn more on how to get started.