Swiftpack.co - Package - n13/InstagramAuthOnTheBeach

InstagramAuthOnTheBeach

CI Status Version License Platform

Overview

Precise authentication with Instagram API, not more not less. Unlike the other Instagram auth solutions out there, this one works. Hopefully they'll fix their code soon though.

Client side OAUTH - no need for a server component.

It works like this

  1. Pop a view controller of type InstagramAuthViewController
  2. Set your Instagram client ID and redirect URL
  3. Receive an auth token
  4. Call into the Instagram API using the auth token

I recommend using Alamofire or something reasonable like that to make the API calls - there's an example in the Example project

This pod only takes care of the really messy stuff, which is obtaining the auth token. The reason that is very messy is that we need to show a web page controlled by Instagram, and depending on many different things this page might change, have different content, have a facebook login button, all sorts of things could happen.

I tried two other Instagram authentication pods before writing this. Both didn't work. One of them didn't even handle the messy stuff that InstagramAuthOnTheBeach handles.

The instagram API is very clean and well documented. I don't see a need to wrap these calls into another opaque layer. Authentication is the only part that's messy and that this pod solves for you.

Code Example

let vc = InstagramAuthViewController()
vc.instagramClientId = "YOUR-CLIENT-ID-HERE"
vc.instagramRedirectURL = "YOUR-REDIRECT-URL-HERE"
vc.doneAction = { [weak self] success, token in 

    // ... do what you want with the token....
    
    self?.dismiss(animated: true, completion: nil)

}

present(UINavigationController(rootViewController: vc), animated: true);

Example Project

Check it out!!!

To run the example project, clone the repo, and run pod install from the Example directory first.

Instagram Setup

Log into Instagram Developer

Clieck 'Register a new Client'

Click "Manage Client" button

Go to Security Tab

Then

  1. Get the client ID
  2. Create a valid redirect URI - ideally this is your own domain or website, but can be any valid URI - we don't really access the URI, we only use it to detect the token
  3. Uncheck the 'Disable implicit OAuth" checkbox. Because that's what we're using, implicit oauth.

See the image

alt tag

Installation

InstagramAuthOnTheBeach is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'InstagramAuthOnTheBeach'

Author

n13, nheger@gmail.com

License

InstagramAuthOnTheBeach is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Used By

Total: 0