Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Free login and authentication for iOS apps using phone number

Free login and authentication for iOS apps using phone number

 

Note: There is a rating embedded within this post, please visit this post to rate it.

 

Pham Van Hoang, [email protected], is the author of this article and he contributes to RobustTechHouse Blog

INTRODUCTION

As a developer, you may be familiar with the typical login system using emails, passwords and sign up forms.

However, have you ever found it cumbersome, repetitive and to a certain extent preventive of users from using your app?  Perhaps you have a Phone-based dating application and you want to tie user’s account to something that is unique: Phone Number – an identity that they already use every day without the hassle of dealing (remembering) with passwords. If this idea is so incredible, so why hasn’t anyone started to build a system as such?

But wait, it doesn’t seem that easy at all. To have that feature that I have described, we need to connect to the phone service provider to verify the Number and get the confirmation SMS from user. In order to achieve that, we would first need to have SMS APIs to communicate with your app, which in turn connects to a SMS Aggregator system. Next the SMS Aggregator system will need to communicate with service provider in the country where we distribute the app to verify the number and send the confirmation SMS.

With every million verification, it is likely to cost thousands of dollars, not to mention the efforts to ensure reliability of this system as it scales.

On hind sight, that seems rather impossible. Luckily, there is Digits to solve the problem.

SO, WHAT IS DIGITS?

Digits is a brand-new way to log in to apps with just your phone number, which was announced by Twitter at its mobile developer conference in San Francisco, 2015. Moreover it is completely free and more importantly it is secure.

HOW DIGITS WORKS?

“Digits lets people create an account or sign into your app using nothing but their phone number on iOS and Android. Built using the same global, reliable infrastructure Twitter uses, Digits will verify the user’s phone number with a simple customizable user interface that easily integrates into your app.

Digits extends your existing user/profile database. A successful Digits account creation will return a stable userID to attach or match with your user record, and an oAuth token for the device”

Also Digits is available now in 216 countries and in 28 languages.

INTEGRATE DIGITS

Step 1: Register Fabric accounts, Fabric includes Digits and several other tools such as Crashlytics, the crash-reporting tool and MoPub, its advertising platform, and some other useful tools.

Step 2: Download and install Fabric for Xcode

Step 3: Select the project that you want to integrate Digits

 

Step 4: Install digits

Step 5: Copy and run the scripts in the instructions. If you don’t know where to run script build phase, click the question mark button. It’ll open up the detailed instructions for you.

Step 6: Follow each step in the instructions and imports Digits module in Appdelegate class

Step 7: Build and run your app to confirm that it’s working as expected

 

Now, Let’s Work With Some Codes

To initialize DigitsKit with your app’s credentials, pass them to startWithConsumerKey:consumerSecret: before passing the shared instance to Fabric in your app’s AppDelegate.

Calling startWithConsumerKey:consumerSecret: will override any keys which were automatically configured. Automatically configured keys resides in your app’s Info.plist under the key Fabric.

[[Digits sharedInstance] startWithConsumerKey:@"your_key" consumerSecret:@"your_secret"];
[Fabric with:@[[Digits sharedInstance]]]

Using the pre-configured button

// Objective-C
- (void)viewDidLoad {
    DGTAuthenticateButton *digitsButton = [DGTAuthenticateButton buttonWithAuthenticationCompletion:^(DGTSession *session, NSError *error) {
        // Inspect session/error objects
    }];
    [self.view addSubview:digitsButton];
}

In the view controller that will display the button, instantiate the pre-configured button DGTAuthenticateButton after the view is loaded (e.g. in the viewDidLoad method) and provide a completion block to handle the provided session object:

This will render a button looks like:

 

 

Using your own button

 In the view controller that displays your custom button, capture a tap event as usual and call the authenticateWithCompletion: method with the completion block that handles the session object:

Digits let you customize the buttons and also the confirmation screen very easily.

// Objective-C
- (void)didTapButton {
    [[Digits sharedInstance] authenticateWithCompletion:^(DGTSession *session, NSError *error) {
        // Inspect session/error objects
    }];
}

Authentication

Once users logged-in, digits will send the session which includes userID, authToken,authTokenSecret, phoneNumber for you to handle in your app. So simple, huh! There are a lot more awesome features in Digits, you can check them out on the Digits site.

If you have any questions, leave the comments below. Thanks for reading.

 

REFERENCE

Twitter Flight – Phone Number Sign In with Digits

https://get.digits.com

 

Brought to you by the RobustTechHouse team. RobustTechHouse works on mobile app development projects and eCommerce & web development projects. If you like our articles, please also check out our Facebook page.

The post Free login and authentication for iOS apps using phone number appeared first on RobustTechHouse.



This post first appeared on Blog - RobustTechHouse, please read the originial post: here

Share the post

Free login and authentication for iOS apps using phone number

×

Subscribe to Blog - Robusttechhouse

Get updates delivered right to your inbox!

Thank you for your subscription

×