Start a new topic

IncompleteRequestBody

Hey, i am setting up a sync adapter for bringing kinvey and titanium as it should be. My only problem at the moment is, that i can't get the login stuff to work. Every time i receive this error: > Error Text::{"error":"IncompleteRequestBody","description":"The request body is either missing or incomplete","debug":"The body of the request is missing credentials required to login"} { [INFO] : beforeSend = ""; [INFO] : password = ***; [INFO] : username = "****"; [INFO] : changes = { [INFO] : }; [INFO] : data = "{}"; [INFO] : error = ""; [INFO] : headers = { [INFO] : Authorization = "Basic ****="; [INFO] : "Content-Type" = "application/json; charset=utf-8"; [INFO] : "X-Kinvey-Api-Version" = 3; [INFO] : }; [INFO] : json = 1; [INFO] : preventActivityIndicator = 1; [INFO] : success = ""; [INFO] : type = POST; [INFO] : url = "https://baas.kinvey.com/user/kid_***/login"; [INFO] : } These are my options for the request, am i missing something? best, Nico

Addition: I've created a small example script: var xhr = Titanium.Network.createHTTPClient({ onload : function() { console.log("loader: " + xhr.responseText); }, onerror : function(e) { console.debug("STATUS: " + this.status); console.debug("TEXT: " + this.responseText); console.error("ERROR: " + e.error); } }); xhr.open("POST", "https://baas.kinvey.com/user/******/login"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", Alloy.Globals.basicAuthValue); xhr.setRequestHeader("X-Kinvey-API-Version", 3); var params = { "username" : "***", "password" : "***" }; xhr.send(params); The Error now is: TEXT: {"error":"Unable to parse the JSON in the request"} Is there something i am missing?
Hey Nico, I ran this by one of our engineers and he seems to think that you might be missing a simple stringify call. I'm thinking your code should probably look a bit more like this: ` var params = // defined params xhr.send(JSON.stringify(params)); ` Let me know if this helps,
Nico, I have solved this issue already, we have a sync adapter that we have been using internally on multiple projects so let talk when you get a moment
Login or Signup to post a comment