Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Running the Sample App with the sample backend


(warning)

Warning

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

step-1-download-the-sample-app page anchor

iOS

step-1-ios page anchor

https://github.com/twilio/mobile-sdk-sample-ios(link takes you to an external page)

https://github.com/twilio/mobile-sdk-sample-android(link takes you to an external page)


We recommend deploying for free with Heroku. You can learn more about how to do that in the Heroku documentation(link takes you to an external page)

Download or clone the sample backend here: https://github.com/twilio/authy-sdk-backend(link takes you to an external page)

Deploy Sample Backend

Step 3: Add AUTHY_API_KEY

step-3-add-authy_api_key page anchor

Setup your AUTHY_API_KEY as a Heroku config variable. You can do this via the CLI(link takes you to an external page) or in the Heroku dashboard(link takes you to an external page).

Deploy Sample Backend.

Step 4: Obtain the USER_AUTHY_ID

step-4-obtain-the-user_authy_id page anchor

Next, we'll create an Authy user.


_10
curl -XPOST "https://api.authy.com/protected/json/users/new \
_10
-H "X-Authy-API-Key: d57d919d11e6b221c9bf6f7c882028f9" \
_10
-d user[email]="user@domain.com" \
_10
-d user[cellphone]="317-338-9302" \
_10
-d user[country_code]="54"


Step 5: Configure sample app

step-5-configure-sample-app page anchor

Follow the instructions to setup the Sample App(link takes you to an external page). 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.

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

step-6-create-an-approval-request page anchor

_10
curl "https://api.authy.com/onetouch/json/users/$USER_AUTHY_ID/approval_requests" \
_10
-H "X-Authy-API-Key: $AUTHY_API_KEY" \
_10
-d message="Login requested for a CapTrade Bank account." \
_10
-d details[username]="Bill Smith" \
_10
-d details[location]="California, USA" \
_10
-d details[Account]="981266321" \
_10
-d hidden_details[transaction_num]="TR139872562346" \
_10
-d seconds_to_expire=1200

More info about creating approval requests

You can also use the sample API scripts available here(link takes you to an external page) to create a new approval request.

To check the status of the approval request you can use the sample API script available here(link takes you to an external page). Don't forget to update your environment variables(link takes you to an external page) when using the sample API scripts(link takes you to an external page).


Step 7: Sync request to device

step-7-sync-request-to-device page anchor

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:

Twilio Auth SDK iOS Push Authentication Request.

Step 8: Disabling specific devices from authentication

step-8-disabling-specific-devices-from-authentication page anchor

To delete a specific device you can use the sample API scripts available here(link takes you to an external page)

To obtain the :device_id call the getDeviceId method of the sdk


If you find any issues while following this guide please file us an issue in the respective Github project:

Android issues on github.com(link takes you to an external page)

iOS issues on github.com(link takes you to an external page)


Rate this page: