---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/verify/tutorials/android-sdk-integration-custom-backend#article
headline: Integrating Twilio Verification SDK for Android using your own backend
description: Lean how to integrate Twilio Verification SDK for Android using your own backend with this guide on implementing a token service.
url: https://www.twilio.com/docs/verify/tutorials/android-sdk-integration-custom-backend
inLanguage: en
dateModified: 2026-06-25T22:34:50.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Integrating Twilio Verification SDK for Android using your own backend

> \[!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](/docs/verify/push) instead, which currently supports the Push channel, and will be enhanced to support the TOTP channel in the future.

Once you [integrated the Twilio Verification SDK for Android in your app using the sample backend](/docs/verify/tutorials/android-sdk-integration-sample-backend), you can move forward and implement the token service in your own backend.

In order for you to allow devices to start verifications, you will need to provide a JWT to the devices.

The only functionality that your server needs to provide is a transformation of the user phone number into a signed JWT.

Here's a Ruby/Sinatra example:

```rb title="Token service endpoint (Sinatra)"
require 'jwt'

post "/verify/token" do
  param :phone_number, String, required: true

  payload = {
    app_id: ENV["APP_ID"],
    phone_number: params[:phone_number],
    iat: Time.now.to_i
  }

  jwt_token = JWT.encode(payload, ENV["AUTHY_API_KEY"], "HS256")

  respond_with status: 200, body: {jwt_token: jwt_token}
end
```

For more information and a working example, refer to the [Sample Backend on GitHub](https://github.com/authy/authy-sdk-backend/).

The following tables list all parameters that you can include in the JWT payload.

## Required parameters

| PARAMETER     | TYPE    | DESCRIPTION                        |
| ------------- | ------- | ---------------------------------- |
| app\_id       | integer | The id of your app                 |
| phone\_number | string  | User phone number, in E.164 format |
| iat           | integer | Issued at epoch timestamp          |

## Optional parameters

| PARAMETER    | TYPE    | DESCRIPTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| code\_length | integer | Optional value to change the number of verification digits sent. Default is 4. Allowed values are 4-10.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| via          | string  | This parameter will override the one used by the SDK to force verification method. This can be used to make server-side decision based on any given context such as countries, user, retries, device, etc. Either "sms" or "call".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| locale       | string  | The language of the message received by user. If no locale is given, Authy will try to autodetect it based on the country code. In case that no locale is autodetected, English will be used. Supported languages include: English (en), Arabic (ar), Catalan (ca), Danish (da), German (de), Spanish (es), Greek (el), Finnish (fi), French (fr) , Hebrew (he), Hindi (hi), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Norwegian (nb), Dutch (nl), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Swedish (sv), Thai (th), Tagalog (tl), Turkish (tr), Vietnamese (vi), Mandarin (zh-CN), Cantonese (zh-HK). We support the format country-region as described in IETF's BPC 47. If no region is given (or supported), there will be a default by country |
| exp          | integer | Epoch timestamp to set the expiration time for this token. Default and maximum value is 1 hour. For security reasons the API will reject JWT expired, also taking into account issued at date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Next step

[Register your app in the Twilio Verification API](/docs/verify/tutorials/android-sdk-register-your-app).
