forked from OAuthSwift/OAuthSwift
-
Notifications
You must be signed in to change notification settings - Fork 0
Uber
Dongri Jin edited this page Aug 26, 2015
·
1 revision
<script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
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 = generateStateWithLength(20) as String
let redirectURL = "https://oauthswift.herokuapp.com/callback/uber".stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
oauthswift.authorizeWithCallbackURL( NSURL(string: redirectURL!)!, scope: "profile", state: state, success: {
credential, response, parameters in
self.showAlertView("Uber", message: "oauth_token:\(credential.oauth_token)")
}, failure: {(error:NSError!) -> Void in
print(error.localizedDescription)
})
Add contentType: "multipart/form-data"