iOS Tutorials: Authentication with Twitter Login

OBJECTIVE

With the increase use of Social Media, the integration of Social Media with apps is getting more and more common. Many reason behind the integration include the convenience instead of going through an account creation and couldn’t keep track of your account and password. I am glad that Social Media companies do it this way as it definitely is more user friendly in a way. Our objective today is to create a login button for Twitter.

THE SIMPLE STEPS

With the introduction of iOS 11, a lot has changed especially with the implementation of Social Media logins. Create your project and configure your Main.storyboard.

Download the Twitter icon for the project and upload it on Assets.xcassets and rename it accordingly. Create one new button and upload the image that was uploaded and configure the background color accordingly. 

Next step, we’ll have to use Cocoapods to import some libraries. If you have not set it up yet, check out my other post.

To make sure that you are on the right track, see that it installs both TwitterCore and TwitterKit. You’ll have to create an access from Twitter development site to get the Consumer Key & Consumer Secret.

Make sure that your Consumer Key & Consumer Secret is kept safe.

Go to General and import the required framework for each section. We will importing SafariServices here so that we could authenticate the login via Safari.

Go to AppDelegate.swift and import the required library

Configure your Consumer Key & Consumer Secret here

On ViewController.swift, create an IBAction for the button to configure the login method

 

The project can be found on GitHub

  • Article By :
    Founder of DaddyCoding. Studied Computer Science, Information System and Information Technology at BYU-Hawaii. Currently spending most of my time researching and learning on helping to expose making iOS apps.

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*