To run the example project, clone the repo, and run pod install
from the Example directory first.
Paparajote is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Paparajote"
In order to use Paparajote you have to make sure the provider is supported. You can check it in the list of supported providers. If it's not supported, you can easily give support to a new provider conforming the protocol:
public typealias Authorization = () -> NSURL
public typealias Authentication = NSURL -> NSURLRequest?
public typealias SessionAdapter = (NSData, NSURLResponse) -> OAuth2Session?
public protocol OAuth2Provider {
var authorization: Authorization { get }
var authentication: Authentication { get }
var sessionAdapter: SessionAdapter { get }
}
- Authorization: Returns the URL that triggers the OAuth2 flow.
- Authentication: Returns an authentication request if the url contains an authentication token.
- SessionAdapter: Extracts the session from the authentication response data.
If you're using UIWebView
from UIKit
you can trigger the OAuth2 with a few simple steps:
- Create an instance of
OAuth2WebviewDelegate
passing the provider, the webview, and a completion closure that will be executed once the authentication completes. - Keep a reference to that delegate from your
ViewController
.
If you're using WKWebView
from WKWebKit
you can trigger the OAuth2 with a few simple steps:
- Create an instance of
OAuth2WKNavigationDelegate
passing the provider, the webview, and a completion closure that will be executed once the authentication completes. - Keep a reference to that delegate from your
ViewController
.
This project is funded and maintained by Caramba. We 💛 open source software!
Check out our other open source projects, read our blog or say 👋 on twitter @carambalabs.
Contributions are welcome 🤘 We encourage developers like you to help us improve the projects we've shared with the community. Please see the Contributing Guide and the Code of Conduct.
Paparajote is available under the MIT license. See the LICENSE file for more info.