Swiftpack.co - Package - twilio/twilio-verify-ios

Twilio Verify iOS

CircleCI CocoaPods Compatible Carthage Compatible Swift Package Manager Compatible Platform Swift 5.2 License

Table of Contents


Twilio Verify Push SDK helps you verify users by adding a low-friction, secure, cost-effective, "push verification" factor into your own mobile application. This fully managed API service allows you to seamlessly verify users in-app via a secure channel, without the risks, hassles or costs of One-Time Passcodes (OTPs). This project provides an SDK to implement Verify Push for your iOS app.




  • iOS 10+
  • Swift 5.2
  • Xcode 11.x


SDK API docs



CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate TwilioVerify into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'TwilioVerify', '~> 0.1.1'


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate TwilioVerify into your Xcode project using Carthage, specify it in your Cartfile:

github "twilio/twilio-verify-ios" -> 0.1.1

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but TwilioVerify does support its use on iOS.

Once you have your Swift package set up, adding TwilioVerify as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/twilio/twilio-verify-ios.git", .upToNextMajor(from: "0.1.1"))

Register Your App with APNs

If you want to receive challenges as push notifications, you should register Your App with APNs. More info here


See Verify Push Quickstart for a step-by-step guide to using this SDK in a basic Verify Push implementation.

Running the Sample app

To run the Sample App:

  • Clone the repo
  • Change the Bundle Identifier to something unique so Appleā€™s push notification server can direct pushes to this app
  • Enable push notifications
  • Get the Access token generation URL from your backend (Running the Sample backend). You will use it for creating a factor
  • Run the TwilioVerifyDemo project using Release as build configuration

Running the Sample backend

  • Clone this repo: https://github.com/twilio/verify-push-sample-backend
  • Configure a Push Credential for the sample app, using the same APNs configuration
  • Configure a Verify Service, using the Push Credential for the sample app
  • Run the steps in the README file

Using the sample app

Adding a factor

  • Press Create factor in the factor list (click on the +, top right)
  • Enter the identity to use. This value should be an UUID that identifies the user to prevent PII information use
  • Enter the Access token URL (Access token generation URL, including the path, e.g. https://yourapp.ngrok.io/accessTokens)
  • Press Create factor
  • Copy the factor Sid

Sending a challenge

  • Go to Create Push Challenge page (/challenge path in your sample backend)
  • Enter the identity you used in factor creation
  • Enter the Factor Sid you added
  • Enter a message. You will see the message in the push notification and in the challenge view
  • Enter details to the challenge. You will see them in the challenge view. You can add more details using the Add more Details button
  • Press Create challenge button
  • You will receive a push notification showing the challenge message in your device.
  • The app will show the challenge info below the factor information, in a Challenge section
  • Approve or deny the challenge
  • After the challenge is updated, you will see the challenge status in the backend's Create Push Challenge view


Types | Code | Description ---------- | ----------- | ----------- Network | 68001 | Exception while calling the API Mapping | 68002 | Exception while mapping an entity Storage | 68003 | Exception while storing/loading an entity Input | 68004 | Exception while loading input Key Storage | 68005 | Exception while storing/loading key pairs Initialization | 68006 | Exception while initializing an object Authentication Token | 68007 | Exception while generating token

Update factor's push token

You can update the factor's push token in case it changed, calling the TwilioVerify.updateFactor method:

let updateFactorPayload = UpdatePushFactorPayload(sid: factorSid, pushToken: newPushToken)
twilioVerify.updateFactor(withPayload: payload, success: { factor in
  // Success
}) { error in
  // Error

See FactorListPresenter in the sample app. You should update the push token for all factors.

Delete a factor

You can delete a factor calling the TwilioVerify.deleteFactor method:

twilioVerify.deleteFactor(withSid: factorSid, success: {
  // Success
}) { error in
  // Error


Stars: 3


Used By

Total: 0


0.1.1 - 2020-10-15 22:26:35

0.1.1 (2020-10-15)

Bug fixes

  • Added support for iOS 10 (9549956)

0.1.0 - 2020-10-13 22:42:54

0.1.0 (2020-10-13)


Bug fixes

  • Delete factor should delete it locally for deleted factors from API (bfffa2f)
  • Support new challenge format (#97) (c7a8a71)

Code refactoring

  • Create factor body params (5b1a79e)
  • Update factor body params (8196548)

Building system

  • Added github issue templates and code of conduct (c00b331)
  • Change overall coverage to 70 (5cdf81e)
  • Update coverage to 70 (694c88f)


  • Add SDK API docs link, update factor's push token and delete factor sections in readme (ec0467e)

0.0.4 - 2020-09-11 21:28:03


  • Storage migration


  • TwilioVerifyBuilder.build() could throw an exception

0.0.3 - 2020-08-12 00:07:17

0.0.2 - 2020-08-01 00:10:54

0.0.1 - 2020-07-30 13:47:50