Skip to content
Sokichi Fujita edited this page Mar 30, 2020 · 3 revisions

Uber settings

OAuth

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"