Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Quick Reference

For iOS projects, make sure you import the framework in the files in which you will interact with the SDK.

        
        
        
        
              
              
              
              
                    
                    
                    
                    

                    Make sure the current device is registered by calling isDeviceRegistered.

                          
                          
                          
                          

                          To obtain the device id, call the getDeviceId method. This method will be useful for device specific operations such as deletion.

                                
                                
                                
                                

                                Approval Requests

                                To create a new approval request, you can follow the instructions here or use the pre-built Authy API scripts available here.

                                Call getApprovalRequests to get the list of approval requests:

                                      
                                      
                                      
                                      

                                      Call approveRequest or denyRequest to handle approval requests.

                                            
                                            
                                            
                                            

                                            If you configured a callback url in the Dasboard to receive notifications when a user approves/denies a request it will be called after this step. Otherwise you should poll the OneTouch API. For more details go here.

                                            Push notification handling

                                            In order to interact with the request notifications you will need to update the push token every time it changes in the device.

                                                  
                                                  
                                                  
                                                  

                                                  Once the notification arrives, you will need to pull it from the TwilioAuth API. The reason for this is that it contains sensitive information, so the device must retrieve it through the TwilioAuth SDK instead of having it directly in the notification payload.

                                                        
                                                        
                                                        
                                                        

                                                        Time-based One Time Passwords (TOTP)

                                                        As a fallback when OneTouch requests aren’t functioning (more specifically, if the user is in Airplane mode, has no Wi-Fi / cell connection, misses the push notification or simply prefers to type the generated code in for validation instead of pushing the Approve/Deny button) you can obtain a TOTP.

                                                        The TOTP will be valid for 30 seconds and you can obtain it as follows:

                                                              
                                                              
                                                              
                                                              

                                                              Additionally your class must implement the AUTTOTPDelegate protocol (on iOS) or the TOTPCallback interface (on Android) to be able to receive the TOTP:

                                                                    
                                                                    
                                                                    
                                                                    

                                                                    Important note:

                                                                    This delegate/callback listener will receive a TOTP immediately, which will be generated with the local token. Then the SDK will try to sync the token with TwilioAuth API in the background. If that token differs (i.e. digits changed, seed was rotated, or token was removed) your delegate will receive another call with the newest TOTP.

                                                                    Helper methods

                                                                    To delete the device local data you can use the following method:

                                                                          
                                                                          
                                                                          
                                                                          

                                                                          Please note this method doesn't delete the device in the Authy backend, it only clears the data stored locally on the device. For example, you may use this method as a logout option inside your app.

                                                                          Support

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

                                                                          Android issues on github.com

                                                                          iOS issues on github.com

                                                                          Rate this page:

                                                                          Need some help?

                                                                          We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.