GithubHelp home page GithubHelp logo

runt18 / simpleauth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from calebd/simpleauth

0.0 2.0 0.0 1.75 MB

Simple social authentication for iOS.

Home Page: http://simpleauth.io

License: MIT License

Ruby 2.13% Objective-C 97.87%

simpleauth's Introduction

SimpleAuth

SimpleAuth is designed to do the hard work of social account login on iOS. It has a small set of public APIs backed by a set of "providers" that implement the functionality needed to communicate with various social services.

SimpleAuth currently has the following providers:

Installing

Install SimpleAuth with CocoaPods. For example, to use Facebook and Twitter authentication, add

pod 'SimpleAuth/Facebook'
pod 'SimpleAuth/Twitter'

to your Podfile.

Usage

Configuring and using SimpleAuth is easy:

// Somewhere in your app boot process
SimpleAuth.configuration()["twitter"] = [
    "consumer_key": "KEY",
    "consumer_secret": "SECRET"
]
// Authorize
func loginWithTwitter() {
    SimpleAuth.authorize("twitter", completion: { responseObject, error in
        println("Twitter login response: \(responseObject)")
    })
}

Implementing a Provider

The API for creating providers is pretty simple. Be sure to look at SimpleAuthProvider and SimpleAuthWebLoginViewController. These classes will help you simplify your authentiction process. Providers should be stored in Pod/Providers/ and have an appropriately named folder and sub spec. All providers are automatically registered with the framework. There are a handful of methods you'll need to implement:

Let SimpleAuth know what type of provider you are registering:

+ (NSString *)type {
    return @"facebook";
}

Optionally, you may return a set of default options for all authorization options to use:

+ (NSDictionary *)defaultOptions {
    return @{
        @"permissions" : @[ @"email" ]
    };
}

Finally, provide a method for handling authorization:

- (void)authorizeWithCompletion:(SimpleAuthRequestHandler)completion {
	// Use values in self.options to customize behavior
	// Perform authentication
	// Call the completion
}

The rest is up to you! I welcome contributions to SimpleAuth, both improvements to the library itself and new providers.

License

SimpleAuth is released under the MIT license.

Thanks

Special thanks to my friend @soffes for advising on the SimpleAuth API design.

Contributors

simpleauth's People

Contributors

alexito4 avatar amarcadet avatar aschuch avatar bhstahl avatar calebd avatar jerson avatar kornifex avatar markkrenek avatar mouhcine avatar paulyoung avatar ramonvic avatar xerox avatar

Watchers

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