On this page

Integrating the SDK using your own backend


For instructions on how to get the AUTHY_API_KEY please check this

1.Download the iOS/Android SDK

iOS

  • Add the pod to your Podfile
1
target 'YourTarget' do
2
pod 'TwilioAuth'
3
end
  • Run the following command in your terminal
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:

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

Android

  • Add the dependency to your app/build.gradle file
compile 'com.twilio:auth:+'

2.In your backend obtain the USER_AUTHY_ID against the Authy API, with the user's cellphone number and email:

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

More info on enabling 2FA.

3.In your backend implement an API call to obtain the registration token

1
curl "https://api.authy.com/protected/json/sdk/registrations?api_key=AUTHY_API_KEY" \
2
-d authy_id="USER_AUTHY_ID"

4.In your app receive/request the registration token from your backend

5.Create an approval request

1
curl "https://api.authy.com/onetouch/json/users/USER_AUTHY_ID/approval_requests" \
2
-d api_key="AUTHY_API_KEY" \
3
-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).

6.Approve/Deny request in your app

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

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