• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

calebd/SimpleAuth: Simple social authentication for iOS.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

calebd/SimpleAuth

开源软件地址:

https://github.com/calebd/SimpleAuth

开源编程语言:

Objective-C 97.9%

开源软件介绍:

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




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
refactoring-challenge/reversi-ios发布时间:2022-06-21
下一篇:
stripe-archive/PaymentKit: Easily accept payments on iOS发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap