A UIViewController subclass for Instagram authentication.

Overview

InstagramAuthViewController

A ViewController for Instagram authentication.

A UIViewController subclass that handles showing the Instagram login page, the authentication dance and finally returning the access token that can be used to communicate with the Instagram API afterwards.

Inspired by Instagram-Auth-iOS. Used PhotoBrowser as a stepping stone. I rewrote the login part in Swift, replced third-party library code with built-in Cocoa Touch frameworks and made it reusable.

Requirements

  • iOS 8.0+
  • Xcode 7.3<

Installation

Manually

  1. Download or clone the repo.
  2. Open the source folder.
  3. Add InstagramAuthViewController.swift to your project.
  4. Profit(?)!

Usage example

  • Go to Instagram's developer portal and register your application.
  • Take note of the client ID, client secret and redirect URI values.
let clientId = "<YOUR CLIENT ID>"
let clientSecret = "<YOUR CLIENT SECRET>"
let redirectUri = "<YOUR REDIRECT URI>"

Storyboards

  • Simply add the InstagramAuthViewController as the UIViewController's class in the Identity inspector.

let instagramAuthViewController = segue.destinationViewController as! InstagramAuthViewController
instagramAuthViewController.delegate = self
instagramAuthViewController.clientId = clientId
instagramAuthViewController.clientSecret = clientSecret
instagramAuthViewController.redirectUri = redirectUri

Programmatically

  • Initialize an instance of InstagramAuthViewController and present it like a normal ViewController.
let instagramAuthViewController = InstagramAuthViewController(clientId: clientId, clientSecret: clientSecret, redirectUri: redirectUri)
instagramAuthViewController.delegate = self
presentViewController(instagramAuthViewController, animated: true, completion: nil)
  • Either way, don't forget to implement the InstagramAuthDelegate.
func instagramAuthControllerDidFinish(accessToken: String?, error: NSError?) {
    if let error = error {
        print("Error logging in to Instagram: \(error.localizedDescription)")
    } else {
        print("Access token: \(accessToken!)")
    }
}

Contribute & Bug Fixes

I would love for you to contribute to InstagramAuthViewController, check the LICENSE file for more info. Pull requests, bug fixes, improvements welcome.

Meta

Isuru Nanayakkara – @IJNanayakkara[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/Isuru-Nanayakkara

You might also like...
A simple way to create custom interactive UIViewController transitions
A simple way to create custom interactive UIViewController transitions

EasyTransitions is a library that helps developers create custom interactive transitions using simple functions defined in a protocol and avoid handli

Use PanGesture to dismiss view on UIViewController and UIView
Use PanGesture to dismiss view on UIViewController and UIView

PanSlip Use PanGesture to dismiss view on UIViewController and UIView. Introduction PanSlip to UIViewController left to right right to left top to bot

A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.
A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.

TimeZonePicker A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your

UIViewController drop in replacement with much more customisation
UIViewController drop in replacement with much more customisation

PopupViewController UIAlertController drop in replacement with much more customization You can literally replace UIAlertController by PopupViewControl

Showing / dismissing keyboard animation in simple UIViewController category.
Showing / dismissing keyboard animation in simple UIViewController category.

RSKKeyboardAnimationObserver Easy way to handle iOS keyboard showing/dismissing. Introduction Working with iOS keyboard demands a lot of duplicated co

HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.
HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.

HoverConversion ManiacDev.com referred. https://maniacdev.com/2016/09/hoverconversion-a-swift-ui-component-for-navigating-between-multiple-table-views

VideoSplashKit - UIViewController library for creating easy intro pages with background videos
VideoSplashKit - UIViewController library for creating easy intro pages with background videos

VideoSplashKit - Video based UIViewController Introduction Requires iOS 8 or later and Xcode 6.1+ Swift support uses dynamic frameworks and is therefo

UIViewController drop in replacement with much more customisation
UIViewController drop in replacement with much more customisation

PopupViewController UIAlertController drop in replacement with much more customization You can literally replace UIAlertController by PopupViewControl

Completion Block for UINavigationController Push/Pop UIViewController

JNAPushPopCompletionBlock Synopsis Completion block for [self.navigationController pushViewController:(nonnull UIViewController *) animated:(BOOL)] an

UIViewController extension to present view / view controller as bottom-half modal.
UIViewController extension to present view / view controller as bottom-half modal.

UIViewController extension to present view / view controller as bottom-half modal. Installation CocoaPods pod 'SemiModalViewController' Swift Package

Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple
Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple

Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple Follow the tutorial at alfianlosari.com Features Uses Fir

The TouchID authentication mechanism implemented in Swift.

iOS-TouchID-Swift The TouchID authentication mechanism implemented in Swift About In iOS 8, Apple provides a new framework named LocalAuthentication w

A passcode entry field for macOS similar to Apple's two-factor authentication field.
A passcode entry field for macOS similar to Apple's two-factor authentication field.

DSFPasscodeView A passcode entry field for macOS similar to Apple's two-factor authentication field. About The control is made up of multiple groups o

FCLAuthSwift is a Swift library for the Flow Client Library (FCL) that enables Flow wallet authentication on iOS devices.
FCLAuthSwift is a Swift library for the Flow Client Library (FCL) that enables Flow wallet authentication on iOS devices.

FCLAuthSwift is a Swift library for the Flow Client Library (FCL) that enables Flow wallet authentication on iOS devices. Demo The demo a

A chat simulator app that uses FireBase for Authentication and chat storage
A chat simulator app that uses FireBase for Authentication and chat storage

Chat-App Description Flash chat is a chat simulator app that uses FireBase for Authentication and chat storage Tools Used - Swift (Programming Languag

Implementing User Authentication with Sign in with Apple

Implementing User Authentication with Sign in with Apple Provide a way for users of your app to set up an account and start using your services. Overv

A simple project for Face ID Authentication for iOS device using LocalAuthentication Framework

BiometricAuthentication This respository is a simple project for Face ID Authentication for iOS device using LocalAuthentication Framework and infoPli

Save data to the database, real-time synchronization, user authentication.

Shop List App on development stage... description description description description description 🛡️ License This project is licensed under the MIT L

A Flutter powered messaging app including Firebase registration, authentication and group messaging feature.

we_chat A Flutter powered messaging app including Firebase registration, authentication and group messaging feature. Getting Started This project is a

Comments
  • Better README.md

    Better README.md

    Hey @Isuru-Nanayakkara, your library is really interesting.

    The only problem I found was the README.md, which needs a little bit of more information I created this iOS Open source Readme Template so you can take a look on how to better organize. If you want, I can help you to do it

    What are your thoughts?

    opened by lfarah 2
Owner
Isuru Nanayakkara
Isuru Nanayakkara
Implementing User Authentication with Sign in with Apple

Implementing User Authentication with Sign in with Apple Provide a way for users of your app to set up an account and start using your services. Overv

null 0 Oct 18, 2021
A simple project for Face ID Authentication for iOS device using LocalAuthentication Framework

BiometricAuthentication This respository is a simple project for Face ID Authentication for iOS device using LocalAuthentication Framework and infoPli

Lee McCormick 0 Oct 23, 2021
Implementing User Authentication with Sign in with Apple

Implementing User Authentication with Sign in with Apple Provide a way for users of your app to set up an account and start using your services. Overv

Liselot 0 Dec 2, 2021
Example of simple OAuth2 authentication using Alamofire 5 and RxSwift library

REST Client based on Alamofire 5 and RxSwift library. Supports OAuth2 and Basic authentication interceptor.

Tomáš Smolík 3 Dec 8, 2022
InstagramLogin allows iOS developers to authenticate users by their Instagram accounts.

InstagramLogin handles all the Instagram authentication process by showing a custom UIViewController with the login page and returning an access token that can be used to request data from Instagram.

Ander Goig 67 Aug 20, 2022
A quick and simple way to authenticate an Instagram user in your iPhone or iPad app.

InstagramSimpleOAuth A quick and simple way to authenticate an Instagram user in your iPhone or iPad app. Adding InstagramSimpleOAuth to your project

Ryan Baumbach 90 Aug 20, 2022
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

Babylon Health 773 Dec 27, 2022
UIViewController subclass to beautifully present news articles and blog posts.

LMArticleViewController This framework allows you to create Apple News-inspired UIViewControllers with ease. It is heavily inspired by MRArticleViewCo

Luca Mozzarelli 7 Feb 3, 2022
UIViewController subclass inspired by "Inbox by google" animated transitioning.

SAInboxViewController SAInboxViewController realizes Inbox like view transitioning. You can launch sample project on web browser from here. Features I

Taiki Suzuki 298 Jun 29, 2022
Instagram clone, the main focus of the app is the seamless swipe between views that we see on instagram

InstaSwipe Instagram clone, the main focus of the app is the seamless swipe betw

Stavros Pachoundakis 1 Dec 15, 2022