OAuthSwiftAlamofire

OAuthSwift Alamofire

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

使用 OAuthSwiftAlamofire 请求进行签名的实用方法。

如何使用

此框架提供一个 RequestInterceptor 用于设置到 Alamofire Session 中。

let interceptor = oauthswift.requestInterceptor
let session = Session(interceptor: interceptor)

然后您可以像往常一样发起请求。

session.request("http://oauthbin.com/v1/echo")

或者将 interceptor 作为 request 函数的参数传递。

session.request("http://oauthbin.com/v1/echo", interceptor: interceptor)

⚠️您必须先调用 OAuthSwift 上的 authorize 函数,否则任何请求都不会被签名。

刷新令牌

OAuth2 interceptor 还会自动刷新访问令牌,使用 Alamofire 的 RequestRetrier 机制。

安装

支持 Carthage

github "OAuthSwift/OAuthSwiftAlamofire"

支持 CocoaPods

use_frameworks!

pod 'OAuthSwiftAlamofire'