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

Overview

InstagramSimpleOAuth Bitrise Cocoapod Version Carthage Compatible Cocoapod Platform License

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

iPhone 7 Screenshot iPad Pro 9.7 Screenshot

Adding InstagramSimpleOAuth to your project

CocoaPods

CocoaPods is the recommended way to add InstagramSimpleOAuth to your project.

  1. Add InstagramSimpleOAuth to your Podfile pod 'InstagramSimpleOAuth'.
  2. Install the pod(s) by running pod install.
  3. Add InstagramSimpleOAuth to your files with #import <InstagramSimpleOAuth/InstagramSimpleOAuth.h>.

Carthage

  1. Add github "rbaumbach/InstagramSimpleOAuth" to your Cartfile.
  2. Follow the directions to add the dynamic framework to your target.

Clone from Github

  1. Clone repository from github and copy files directly, or add it as a git submodule.
  2. Add all files from 'Source' directory to your project (as well as the dependencies listed in the Podfile).

How To

  • Create an instance of InstagramSimpleOAuthViewController and pass in an Instagram client ID, client secret, client callback URL and completion block to be executed with InstagramLoginResponse and NSError arguments.
  • Once the instance of InstagramSimpleOAuthViewController is presented (either as a modal or pushed on the navigation stack), it will allow the user to login. After the user logs in, the completion block given in the initialization of the view controller will be executed. The argument in the completion block, InstagramLoginResponse, contains an accessToken and other login information for the authenticated user provided by Instagram API Response. If there is an issue attempting to authenticate, an error will be given instead.
  • By default, if there are issues with authentication, an UIAlertView will be given to the user. To disable this, and rely on the NSError directly, set the property shouldShowErrorAlert to NO.
  • The default Instagram scope permissions for authentication are 'basic.' If additional permissions are needed, the permissions can be set using the permissionScope property.
  • Note: Even though an instance of the view controller itself can be initialized without client ID, client secret, client callback and completion block (to help with testing), this data must be set using the view controller's properties before it is presented to the user.

Example Usage

// Simplest Example:

InstagramSimpleOAuthViewController
    *viewController = [[InstagramSimpleOAuthViewController alloc] initWithClientID:@"123I_am_a_client_id_567890"
                                                                      clientSecret:@"shhhhhh, I'm a secret"
                                                                       callbackURL:[NSURL URLWithString:@"http://your.fancy.site"]
                                                                        completion:^(InstagramLoginResponse *response, NSError *error) {
                                                                            NSLog(@"My Access Token is: %@", response.accessToken);
                                                                        }];
[self.navigationController pushViewController:viewController
                                     animated:YES];

// Authenticate with all scope permissions and disable error UIAlertViews Example:

InstagramSimpleOAuthViewController
    *viewController = [[InstagramSimpleOAuthViewController alloc] initWithClientID:@"clients_r_us"
                                                                      clientSecret:@"shhhhhh, don't tell"
                                                                       callbackURL:[NSURL URLWithString:@"http://your.non.fancy.site"]
                                                                        completion:^(InstagramLoginResponse *response, NSError *error) {
                                                                            NSLog(@"My Username is: %@", response.user.username);
                                                                        }];
viewController.shouldShowErrorAlert = NO;
viewController.permissionScope = @[@"basic", @"comments", @"relationships", @"likes"];

[self.navigationController pushViewController:viewController
                                     animated:YES];

Testing

This project has been setup to use fastlane to run the specs.

First, run the setup.sh script to bundle required gems and Cocoapods when in the project directory:

$ ./setup.sh

And then use fastlane to run all the specs on the command line:

$ bundle exec fastlane specs

Version History

Version history can be found on releases page.

Suggestions, requests, and feedback

Thanks for checking out InstagramSimpleOAuth for your in-app Instagram Authentication. Any feedback can be can be sent to: [email protected].

Comments
  • Crash on login

    Crash on login

    Hi, I'm using the InstagramSimpleOAuthViewController to login the user into my app, but the library crashes on the method - (instancetype)initWithInstagramOAuthResponse:(NSDictionary *)response in the class InstagramLoginResponse

    with the error Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[InstagramUser initWithDictionary:]: unrecognized selector sent to instance

    I'm using the InstagramSimpleOAuthViewController as-is in your explanations with SDK 8.1 What's wrong?

    Thanks \m

    opened by mrigo 6
  • InstagramSimpleOAuthViewController dismisses automatically with an error

    InstagramSimpleOAuthViewController dismisses automatically with an error

    Hi,

    I'm not sure if this is bug of your library of just a lack of documentation but when I try to present InstagramSimpleOAuthViewController it shows spinner and after few moments callback block gets called with given error:

    Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSErrorFailingURLStringKey=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42#cb=f117246175298ac&domain=www.instagram.com&origin=https%3A%2F%2Fwww.instagram.com%2Ff325e717a66a4d4&relation=parent&error=unknown_user, NSErrorFailingURLKey=https://staticxx.facebook.com/connect/xd_arbiter/r/xaOI6zd9HW9.js?version=42#cb=f117246175298ac&domain=www.instagram.com&origin=https%3A%2F%2Fwww.instagram.com%2Ff325e717a66a4d4&relation=parent&error=unknown_user})

    I'm sure that cliendID, clientSecret and callbackURL are correct.

    opened by josipbernat 5
  • InstagramLoginResponse with fully qualified redirection URI tweak

    InstagramLoginResponse with fully qualified redirection URI tweak

    hi, we’re exploring to replace the old Google oAuth 2.0 iOS libs and this looks great, nice one.

    However, your InstagramLoginResponse completion block wouldn’t fire for us, and looking into it I noticed that our authcallback URL was fully qualified i.e. domain.com/services/authcallback.html instead of say domain.com/callback/ — suppose both are valid callbacks.

    So we had to remove the / prefix from the InstagramAuthCodeParam constant in InstagramLoginUtils.

    *NSString const InstagramAuthCodeParam = @"?code="; // /?code=

    Hope this helps someone

    opened by alexanderkent 3
  • Relogin

    Relogin

    When the user login once , the code does not allows to re-login with another account, after the user on clicking the button again. The view controller is pushed and if user has already logged in then VC is popped and user cant change his account.

    opened by kunalgupta1593 1
  • User sign-out, persistency?

    User sign-out, persistency?

    So the entire auth is cookie-based but cookies get (sometimes) set at weird times. It appears a cookie will be set once the user has been authenticated (after a few seconds).

    Wondering, what would be best approach to implement a sign-out; basically to reset the InstagramSimpleOAuthViewController to allow different credentials?

    Clear the cookies?? i.e. something like:

    -(IBAction) signOut:(id)sender{ NSHTTPCookie *cookie; NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (cookie in [storage cookies]){ [storage deleteCookie:cookie]; } [[NSUserDefaults standardUserDefaults] synchronize]; [self loginController]; // show clean auth view }

    opened by alexanderkent 1
  • Fix #10 by removing dismissViewController on error loading request in…

    Fix #10 by removing dismissViewController on error loading request in…

    Hi @rbaumbach, using this commit I attempt to solve the issue #10 by removing dismissViewController. In my opinion the right approach to call dismissViewController is either if the request is success, or the developer add dismiss button by wrapping the InstagramSimpleOAuthViewController in UINavigationController.

    opened by ibnusina 0
  • Maintenance Update

    Maintenance Update

    This is primarily a maintenance update.

    • Updates project file using current version of Xcode
    • Fixes minor issues in DemoApp
    • Updates internal gems, Cocoapods and Carthage modules
    • Fixes broken specs caused by current versions of Specta/Expecta
    • Migrates from CircleCI 1.0 -> CircleCI 2.0
    opened by rbaumbach 0
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull requests corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    Created with cocoapods-readme.

    opened by ReadmeCritic 0
  • Bump excon from 0.67.0 to 0.71.0

    Bump excon from 0.67.0 to 0.71.0

    Bumps excon from 0.67.0 to 0.71.0.

    Changelog

    Sourced from excon's changelog.

    0.71.0 2019-12-12

    fix for leftover data with interrupted persistent connections

    0.70.0 2019-12-02

    Update bundled certificates

    0.69.1 2019-11-21

    Fix mistake in proxy connection error handling

    0.69.0 2019-11-21

    Raise better proxy connection errors

    0.68.0 2019-10-25

    Updated bundled certs

    Commits
    • 1149d44 v0.71.0
    • ccb57d7 fix for leftover data with interrupted persistent connections
    • f8de8cf v0.70.0
    • 93f4a21 v0.69.1
    • e89bbb7 Merge pull request #709 from jasquat/fix_response_status_check
    • 5647437 fixed response status check when making a request with a valid proxy is set
    • f769176 v0.69.0
    • 20c0748 define ProxyConnectionError
    • f44106a raise on failed proxy connect
    • d7ed5fe be thorough in unsubscribing to notifications in instrumentation tests
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(0.5.1)
Owner
Ryan Baumbach
A native California Chicano, forged in the fires of Silicon Valley who is learning more about life in Colorado.
Ryan Baumbach
A quick and simple way to authenticate a Box user in your iPhone or iPad app.

BoxSimpleOAuth A quick and simple way to authenticate a Box user in your iPhone or iPad app. Adding BoxSimpleOAuth to your project CocoaPods CocoaPods

Ryan Baumbach 15 Mar 10, 2021
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
LoginKit is a quick and easy way to add Facebook and email Login/Signup UI to your app.

LoginKit About LoginKit is a quick and easy way to add Facebook and email Login/Signup UI to your app. If you need to quickly prototype an app, create

Icalia Labs 653 Dec 17, 2022
A UIViewController subclass for Instagram authentication.

InstagramAuthViewController A ViewController for Instagram authentication. A UIViewController subclass that handles showing the Instagram login page,

Isuru Nanayakkara 38 Jun 29, 2021
A simple way to implement Facebook and Google login in your iOS apps.

Simplicity Simplicity is a simple way to implement Facebook and Google login in your iOS apps. Simplicity can be easily extended to support other exte

Simplicity Mobile 681 Dec 18, 2022
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
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
LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.

LinkedInSignIn Example To run the example project, clone the repo, and run pod install from the Example directory first. Also you need to setup app on

Serhii Londar 34 Sep 1, 2022
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
ReCaptcha - Add Google's Invisible ReCaptcha v2 to your project

Add Google's Invisible ReCaptcha v2 to your project. This library automatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge if invisibility is not possible.

Flávio Caetano 250 Dec 5, 2022
Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA.

Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA. Krypton implements the standardized FIDO Universal 2nd Facto

krypt.co 332 Nov 5, 2022
A simple OAuth library for iOS with a built-in set of providers

SwiftyOAuth is a small OAuth library with a built-in set of providers and a nice API to add your owns. let instagram: Provider = .instagram(clientID:

Damien 477 Oct 15, 2022
A simple library to make authenticating tvOS apps easy via their iOS counterparts.

Voucher The new Apple TV is amazing but the keyboard input leaves a lot to be desired. Instead of making your users type credentials into their TV, yo

Riz 516 Nov 24, 2022
Simple OAuth2 library with a support of multiple services.

Simple OAuth2 library with a support of multiple services.

HyperRedink 68 May 13, 2022
A simple to use, standard interface for authenticating to oauth 2.0 protected endpoints via SFSafariViewController.

AuthenticationViewController A simple to use, standard interface for authenticating to OAuth 2.0 protected endpoints via SFSafariViewController. Instr

Raul Riera 256 Dec 14, 2022
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
OAuth2 framework for macOS and iOS, written in Swift.

OAuth2 OAuth2 frameworks for macOS, iOS and tvOS written in Swift 5.0. ⤵️ Installation ?? Usage ?? Sample macOS app (with data loader examples) ?? Tec

Pascal Pfiffner 1.1k Jan 2, 2023
Swift based OAuth library for iOS and macOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

OAuthSwift 3.1k Jan 3, 2023
SwiftCoreDataLoginPage - Login and registration with core data

Login and Registration Page with CoreData In this basic project, which was used

Buse Köseoğlu 2 Aug 22, 2022