Running the Sample App with the sample backend
The TwilioAuth SDK has been deprecated. This means that while we will continue to provide maintenance support for existing customers and their usage, we discourage new customers and new usage, as we may shut it down entirely in the future. We strongly recommend using the Verify Push SDK instead, which currently supports the Push channel, and will be enhanced to support the TOTP channel in the future.
For instructions on how to get the AUTHY_API_KEY please read this tutorial
Step 1: Download the sample app
iOS
https://github.com/authy/mobile-sdk-sample-ios
Android
https://github.com/authy/mobile-sdk-sample-android
Step 2: Deploy the sample backend application
We recommend deploying for free with Heroku. You can learn more about how to do that in the Heroku documentation
Download or clone the sample backend here: https://github.com/authy/authy-sdk-backend
Step 3: Add AUTHY_API_KEY
Setup your AUTHY_API_KEY as a Heroku config variable. You can do this via the CLI or in the Heroku dashboard.
Step 4: Obtain the USER_AUTHY_ID
Next, we'll create an Authy user.
curl -XPOST "https://api.authy.com/protected/json/users/new \
-H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9" \
-d user[email]="user@domain.com" \
-d user[cellphone]="317-338-9302" \
-d user[country_code]="54"
Step 5: Configure sample app
iOS
Follow the instructions to setup the Sample App. Start the application from XCode and in the simulator you'll be able to enter your USER_AUTHY_ID from step #5 and your sample backend URL from step #2.
Android
In the sample app, enter the USER_AUTHY_ID from step #5 and your sample backend URL from step #2
Step 6: Create an approval request
curl "https://api.authy.com/onetouch/json/users/$USER_AUTHY_ID/approval_requests" \
-H "X-Authy-API-Key: $AUTHY_API_KEY" \
-d message="Login requested for a CapTrade Bank account." \
-d details[username]="Bill Smith" \
-d details[location]="California, USA" \
-d details[Account]="981266321" \
-d hidden_details[transaction_num]="TR139872562346" \
-d seconds_to_expire=1200
More info about creating approval requests
You can also use the sample API scripts available here to create a new approval request.
To check the status of the approval request you can use the sample API script available here. Don't forget to update your environment variables when using the sample API scripts.
Step 7: Sync request to device
If you have configured Twilio to handle the push notification, it will prompt the user to open the app and in turn the SDK will sync the request.
Otherwise, to manually sync the requests to the sample app, refresh the screen. Then, you will be able to Approve or Deny the request in the sample app:
Step 8: Disabling specific devices from authentication
To delete a specific device you can use the sample API scripts available here
To obtain the :device_id call the getDeviceId
method of the sdk
Support
If you find any issues while following this guide please file us an issue in the respective Github project:
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.