Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Running the Sample App with the sample backend

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

Deploy Sample 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.

Deploy Sample Backend

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:

Twilio Auth SDK iOS Push Authentication Request

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:

Android issues on github.com

iOS issues on github.com

Rate this page:

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 browsing the Twilio tag on Stack Overflow.