Authy Mobile SDK - Back End and Apps

Key Concepts

Now that you've set up the Authy Mobile SDK in your iOS or Android mobile app, you're ready to set up a sample backend application to handle the device registration.

Sample Backend Application

This application communicates with the Authy service to register new devices and interface with your mobile app as well. You can use your own backend application but we are providing you a sample application in case you want to try a few things first.

Sample Mobile App

This is the mobile app that you're going to include the Authy Mobile SDK.

Authy Mobile SDK

The Authy Mobile SDK provides helper methods to interact with the Authy Mobile SDK. These methods allow you to:

  • Register a device

  • Get a list of approval requests

  • Approve or deny a request

Sample Backend Application Instructions

The sample backend application is available here and implements the necessary tasks to interact with the Authy service.

You can either deploy to Heroku or download the sample code and run the server yourself.

How to Deploy to Heroku

Requirements

  1. Create a Twilio account here

  2. Go to the Authy Dashboard and create a new Authy application.

  3. Once you've create a new Authy application, copy the API Key for Production available in the Authy Dashboard. See the image below for reference:

    Dashboard API key

  4. Click on the OneTouch option in the left menu and then click Enable OneTouch for your application. See the image below for reference:

Enable OneTouch in Dashboard

Deployment

  1. Click the Deploy to Heroku button in the GitHub repository to setup and deploy your sample backend application to Heroku.

    Deploy to Heroku

  2. In the Heroku dashboard, click in Settings and add a Config Variable called AUTHY_API_KEY. The value of this variable must be your API Key for Production from the Authy application you've created above. Your settings should look like the image below:

    Config Variables

  3. Click in the Open app button on the top right corner and your application should look like this:

    Sample Back End Deployment

This indicates that you've successfully deployed the sample backend application.

Update your iOS Sample Mobile app

Copy the URL of your sample backend application and go back to your iOS project to update it.

Change the value of the API_URL in RegisterViewController.swift to your sample backend application URL.

let API_URL: String = "https://your-application.herokuapp.com"

Update your Android Sample Mobile app

Copy the URL of your sample backend application and go back to your iOS project to update it.

Change the value of the API_URL in Constants.java to your sample backend application URL.

public class Constants {
    public final static String API_URL = "your-application.herokuapp.com";
}

Create an Approval request

Go to http://docs.authy.com/onetouch.html#create-approvalrequest to learn how to create approval requests.

You can also use the sample API script available here to create new approval requests.

To check the status of the approval request you cans use the sample API script available here. Don't forget to change your environment variables when using the sample API scripts.

Push Notifications

Currently the Mobile SDK does not setup push notifications automatically, so if you need your application to notify your users of a new Approval Requests you have to setup Push Notifications manually on your mobile application.

To learn more about setting up iOS Remote Notifications in your mobile app visit the following resource: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html

To learn more about setting up Android Notifications in your mobile app visit the following resource: https://developers.google.com/cloud-messaging/android/start