Git Product home page Git Product logo

igauth's Introduction

IGAuth

CI Status License Platform Version Carthage compatible

IGAuth allows iOS developers to authenticate users by their Instagram accounts.

IGAuth 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.

Inspired by projects like InstagramAuthViewController and InstagramSimpleOAuth, because of the need for a simple and easy way to authenticate Instagram users.

IGAuth Demo (GIF)

Features

  • Customizable Options
  • Multiple Accounts Login
  • 1Password Extension Support
  • More Coming...

Example

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

Second, go to your Instagram's developer portal, click on Manage your client, and uncheck the option "Disable implicit OAuth" from the Security tab.

Third, edit the Constants.swift file with your client info from Instagram's developer portal:

let clientID = "YOUR CLIENT ID GOES HERE"
let redirectURI = "YOUR REDIRECT URI GOES HERE"

Fourth, go ahead and test it! ๐Ÿš€

Requirements

  • iOS 9.0+
  • Xcode 9.0+
  • Swift 3.2+

Installation

CocoaPods

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

pod 'IGAuth'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

To integrate IGAuth into your Xcode project using Carthage, specify it in your Cartfile:

github "AnderGoig/IGAuth"

Follow the detailed guidelines here.

Manual installation

Simply copy the file IGAuthViewController.swift into your Xcode project.

Usage

  1. Go to your Instagram's developer portal, click on Manage your client, and uncheck the option "Disable implicit OAuth" from the Security tab.

  2. Set your client info from Instagram's developer portal:

    let clientID = "YOUR CLIENT ID GOES HERE"
    let redirectURI = "YOUR REDIRECT URI GOES HERE"
  3. Initialize your IGAuthViewController:

    let vc = IGAuthViewController(clientID: clientID, redirectURI: redirectURI) { (accessToken) in
        guard let accessToken = accessToken else {
            print("Failed login")
            return
        }
    
        DispatchQueue.main.async {
            self.navigationController?.popViewController(animated: true)
            // Do your stuff ...
        }
    }
  4. Customize it:

    // Login permissions (https://www.instagram.com/developer/authorization/)
    vc.authScope = "basic+public_content" // basic by default
    
    // ViewController title, website title by default
    vc.customTitle = "Instagram" // By default, the web title is displayed
    
    // Progress view tint color
    vc.progressViewTintColor = UIColor.green // #E1306C by default
    
    // 1Password integration
    vc.allowOnePasswordIntegration = false // true by default
  5. Show it:

    show(vc, sender: self)

Contributing to this project

If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues. Please take a moment to review the guidelines written by Nicolas Gallagher:

License

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

Credits

IGAuth is brought to you by Ander Goig and contributors to the project. If you're using IGAuth in your project, attribution would be very appreciated.

Author

Ander Goig, [email protected]

https://github.com/AnderGoig/IGAuth

igauth's People

Contributors

andergoig avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.