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

Integrating the SDK using 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 check this

  1. Install the iOS/Android SDK

iOS

  • Add the pod to your Podfile

_10
target 'YourTarget' do
_10
pod 'TwilioAuth'
_10
end

  • Run the following command in your terminal

_10
pod install

In the Build Phases tab of the project editor, click the + button at the top and select "New Run Script Phase". Enter the following code into the script text field:


_10
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/TwilioAuth.framework/strip-frameworks.sh"

Android

  • Add the dependency to your app/build.gradle file

_10
compile 'com.twilio:auth:+'

  1. Deploy the sample backend(link takes you to an external page) application
Deploy Sample Backend.
  1. Add AUTHY_API_KEY as a config variable as follows:
Deploy Sample Backend.
  1. Obtain the USER_AUTHY_ID

_10
curl "https://api.authy.com/protected/json/users/new?api_key=AUTHY_API_KEY" \
_10
-d user[email]="user@domain.com" \
_10
-d user[cellphone]="317-338-9302" \
_10
-d user[country_code]="54"

More info on enabling 2FA

  1. In your app obtain the registration token from the sample backend

_10
POST https://yourapp.herokuapp.com/registration/?authy_id="USER_AUTHY_ID"

  1. Create an approval request

_10
curl "https://api.authy.com/onetouch/json/users/USER_AUTHY_ID/approval_requests" \
_10
-d api_key="AUTHY_API_KEY" \
_10
-d message="Your approval request message"

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).

  1. Approve/Deny request

To get more info about what you can do with the SDK: Quick Reference

  1. 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


Support

support page anchor

If you find any inconveniences while following this guide please file us an issue

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: