mercredi 6 mai 2015

Uber Authentication failed "HTTP Status 401: Unauthorized, Response: {"error": "invalid_client"}"

i am using this library for Uber Authetication

http://ift.tt/1zakXLA

I have done like this

func doOAuthUber(){

let oauthswift = OAuth2Swift(
    consumerKey:    "fXfXXXXXXXUo9vtKzobXXXXXUDO",
    consumerSecret: "e5XXXXXXXq2w63qz9szEx7uXXXXXXo03W",
    authorizeUrl:   "http://ift.tt/1HP3zzA",
    accessTokenUrl: "http://ift.tt/1q8M4Bk",
    responseType:   "code"
)

var originalString = "jamesappv2://oauth/callback"
var encodedCallBackUrl = originalString.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())

println("encodedCallBackUrl: \(encodedCallBackUrl)")


let state: String = ""
oauthswift.authorizeWithCallbackURL( NSURL(string: encodedCallBackUrl!)!, scope: "request%20history", state: state, success: {
    credential, response in

    println(credential.oauth_token)
    self.personalDriverLoader.stopAnimating()



    }, failure: {(error:NSError!) -> Void in

        self.personalDriverLoader.stopAnimating()
        println(error.localizedDescription)
})

}

but getting this response HTTP Status 401: Unauthorized, Response: {"error": "invalid_client"}

I have triple checked that my client_id (consumerKey) and secret (consumerSecret) are correct. What I have done wrong here

Please help

Aucun commentaire:

Enregistrer un commentaire