Paparajote 1.1.4

Paparajote 1.1.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Pedro Piñera.



header

Dependency Status

Example

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

Requirements

Installation

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

pod "Paparajote"

Use

Providers

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.

Using UIWebView (iOS only)

If you’re using UIWebView from UIKit you can trigger the OAuth2 with a few simple steps:

  1. Create an instance of OAuth2WebviewDelegate passing the provider, the webview, and a completion closure that will be executed once the authentication completes.
  2. Keep a reference to that delegate from your ViewController.

Using WKWebView (iOS and macOS)

If you’re using WKWebView from WKWebKit you can trigger the OAuth2 with a few simple steps:

  1. Create an instance of OAuth2WKNavigationDelegate passing the provider, the webview, and a completion closure that will be executed once the authentication completes.
  2. Keep a reference to that delegate from your ViewController.

About

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.

Contribute

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.

License

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