Latest 0.1.0
Homepage https://github.com/OAuthSwift/OAuthSwiftFutures
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0
Dependencies OAuthSwift, BrightFutures
Authors

OAuthSwiftFutures

OAuthSwiftFutures bring you futures/promises to OAuthSwift.

It’s build on top BrightFutures to achieve great asynchronous code.

Installation

Support CocoaPods

  • Podfile
use_frameworks!

pod "OAuthSwiftFutures"

How to use

OAuth1.0

let authorizeFuture = oauthswift.authorizeFuture(NSURL(string: "oauth-swift://oauth-callback/twitter")!)
authorizeFuture.onSuccess { credential, response, parameters in
  print(credential.oauth_token)
  print(credential.oauth_token_secret)
  print(parameters["user_id"])
}
authorizeFuture.onFailure { error in
  print(error.localizedDescription)
}

OAuth2.0

let authorizeFuture = oauthswift.authorizeFuture(NSURL(string: "oauth-swift://oauth-callback/facebook")!,
    scope: "likes+comments", state:"generatedone")
authorizeFuture.onSuccess { credential, response, parameters in
  print(credential.oauth_token)
}
authorizeFuture.onFailure { error in
  print(error.localizedDescription)
}

Playing with Future

// after created
let requestFuture = authorizeFuture.flatMap { tuple -> Future<(data: NSData, response: NSHTTPURLResponse), NSError> in
    // will be executed only if authorization succeed
    return oauthswift.client.getFuture("https://api.linkedin.com/v1/people/~")
}
requestFuture.onSuccess { data, response in
  print(data)
}

You can learn more at BrightFutures

License

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

Join the chat at https://gitter.im/dongri/OAuthSwift
License
Platform
Language
Cocoapod

Latest podspec

{
    "name": "OAuthSwiftFutures",
    "version": "0.1.0",
    "license": "MIT",
    "summary": "Bring you futures to OAuthSwift.",
    "description": "OAuthSwiftFutures bring you futures/promises to OAuthSwift.nIt's build on top BrightFutures to achieve great asynchronous code.",
    "homepage": "https://github.com/OAuthSwift/OAuthSwiftFutures",
    "authors": {
        "phimage": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/OAuthSwift/OAuthSwiftFutures.git",
        "tag": "0.1.0"
    },
    "source_files": "OAuthSwiftFutures/*.swift",
    "dependencies": {
        "OAuthSwift": [],
        "BrightFutures": []
    }
}

Pin It on Pinterest

Share This