Vote count:
0
I'm attempting to make a venmo api request to REQUEST (something the sdk doesn't seem like it supports) a payment in my iOS app (Swift) with the following code (please ignore the absence of a phone number, I'm using a friend's to test)
var phone = "<some number>"
var amount = "-0.01"
var message = "test"
var audience = "private"
var atoken = Venmo.sharedInstance().session.accessToken
Venmo.sharedInstance().defaultTransactionMethod = VENTransactionMethod.API
var response: AutoreleasingUnsafeMutablePointer<NSURLResponse?>=nil
var error: AutoreleasingUnsafeMutablePointer<NSError?> = nil
var url_str = "http://ift.tt/1ys3fVc"
var url = NSURL(string: url_str)
var request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "POST"
request.setValue("", forHTTPHeaderField: "")
request.setValue("text/html", forHTTPHeaderField: "Content-Type")
request.timeoutInterval = 4.0
var msg = NSURLConnection.sendSynchronousRequest(request, returningResponse: response, error:nil)
if (msg != nil) {
println(NSJSONSerialization.JSONObjectWithData(msg!, options: .MutableContainers, error: nil))
}
The request goes through and msg prints the following error:
Optional({
error = {
code = 261;
message = "You did not pass a valid OAuth access token.";
};
})
Could someone help me figure out what is going on? I've refreshed the token and everything. I even tried putting this code in the completion handler of the refresh token method, to no avail.
asked 2 mins ago
Venmo error : You did not pass a valid OAuth access token
Aucun commentaire:
Enregistrer un commentaire