Utility methods to use OAuthSwift to sign Alamofire request.
This framework provide a RequestInterceptor to set into alamofire Session
let interceptor = oauthswift.requestInterceptor
let session = Session(interceptor: interceptor)Then you can make you request as usual
session.request("http://oauthbin.com/v1/echo")or pass the interceptor as argument of request function
session.request("http://oauthbin.com/v1/echo", interceptor: interceptor)authorize function on your OAuthSwift or nothing will be signed.
The OAuth2 interceptor will also automatically refresh the access token, using the Alamofire RequestRetrier mechanism.
- Install Carthage (https://github.com/Carthage/Carthage)
- Create Cartfile file
github "OAuthSwift/OAuthSwiftAlamofire"
- Run
carthage update. - On your application targets’ “General” settings tab, in the “Embedded Binaries” section, drag and drop OAuthSwift.framework from the Carthage/Build/iOS folder on disk.
- Podfile
use_frameworks!
pod 'OAuthSwiftAlamofire'
