Swiftpack.co -  Swifteroid/ReactiveOAuth as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swifteroid/ReactiveOAuth
OAuthSwift + ReactiveSwift = ๐Ÿฆ„๐Ÿ’–
.package(url: "https://github.com/Swifteroid/ReactiveOAuth.git", from: "2.4.0")

ReactiveOAuth

Build Status GitHub Release Carthage Compatible Platform

ReactiveOAuth is a wrapper for OAuthSwift with ReactiveSwift support and some pre-configured services, mostly useful in macOS projects.

  • โ˜‘ Elegant api with reactive extensions support.
  • โ˜‘ OAuth and re-OAuth (refresh token) commands with or without account details.
  • โ˜‘ Customisable account detalisators: full response / json with custom field filtering.
import AppKit
import Foundation
import ReactiveOAuth
import ReactiveSwift

internal class MainViewController: NSViewController
{
    @IBAction private func handleOAuthButtonAction(_ button: NSButton) {
        let storyboard: NSStoryboard = NSStoryboard(name: "main", bundle: Bundle.main)
        let controller: OAuthViewController = storyboard.instantiateController(withIdentifier: "OAuthViewController") as! OAuthViewController
        let configuration: OAuth.Configuration = Dropbox.configure(access: Access(key: "foo", secret: "bar"), url: "https://baz.com/quz")
        let detalisator: Detalisator<String> = DropboxDetalisator()
        let oauth: DetailedOAuth<String> = DetailedOAuth(oauth: OAuth(configuration: configuration), detalisator: detalisator)

        oauth.reactive.authorised.observe(Observer(
            value: { (credential: Credential, string: String) in
                Swift.print(credential, string)
            },
            failed: { (error: ReactiveOAuth.Error) in
                Swift.print(error.description)
            }
        ))

        self.authorise(oauthViewController: controller, oauth: oauth)
    }
}

Install

Add ReactiveOAuth to Cartfile:

github "swifteroid/reactiveoauh" "master"

Testing

ReactiveOAuth uses real accounts for testing provided in test/oauth.json, they are kept blank for security reasons and injected by Travis CI during testing. So, if you want to test your own integrations, simply configure required services, unconfigured ones will be skipped. Travis expects REACTIVEOAUTH_CREDENTIALS environment variable, the following command copies current configuration in acceptable format escaped for shell.

jq --join-output "tojson | @sh" test/oauth.json | pbcopy

GitHub

link
Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jackโ€™d and SCRUFF. We are two of the worldโ€™s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics