Uber
Sokichi Fujita edited this page Mar 30, 2020
·
3 revisions
let oauthswift = OAuth2Swift(
consumerKey: Uber["consumerKey"]!,
consumerSecret: Uber["consumerSecret"]!,
authorizeUrl: "https://login.uber.com/oauth/authorize",
accessTokenUrl: "https://login.uber.com/oauth/token",
responseType: "code",
contentType: "multipart/form-data"
)
let state: String = generateState(withLength: 20) as String
let redirectURL = URL(string:"redirect url")
let _ = oauthswift.authorize(withCallbackURL: redirectURL, scope: "profile", state: state) { result in
switch result {
case .success(let (credentials, res, param)):
print(credentials.oauthToken) //OAuth Access Token
case .failure(let error):
print(error.localizedDescription) //Error description
}
}
Add contentType: "multipart/form-data"
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat
](http://mit-license.org) [![Platform](http://img.shields.io/badge/platform-iOS_OSX_TVOS-lightgrey.svg?style=flat ](https://developer.apple.com/resources/) [![Language](http://img.shields.io/badge/language-swift-orange.svg?style=flat ](https://developer.apple.com/swift)