Start a new topic

REST api login via PostMan fails

Hi, 


I'm trying to execute a login via PostMan but seem to hit a barrier .

I get an error that I'm missing data from body but the body contains what it needs and when I add a kinvey api version header i just don't get a response. 


Meanwhile the api on the angular ionic api version works fine.


Could someone explain what I'm missing?


Thanks,


Mihai


Hi Mihai,


Could you please share some more information regarding the request you are trying to execute through Postman:

  • endpoint url
  • headers
  • body
This will help us identify the reason for error. Also if could attach the exact response you are getting.

Waiting forward for your reply.

Regards,
Martin

Hi Mihai,

You should send the request in following way:


  1. Use the correct url. e.g. https://baas.kinvey.com/user/<kid(app id)>/login 
  2. Use the app credentials for authenticating the login request. i.e. Use Basic Authorization of Postman with your app id(kid) as username and app secret as password.
  3. Your request type should be POST and request body should contain two parameters (username and password) along with their values. e.g.
    {
    "username":"value",
    "password":"value"
    }
Please refer the documentation provided here. We hope this helps. If not, Please give us the details of the request that you are submitting through PostMan. 


Hi ,


I made a POST to https://baas.kinvey.com/user/kid_myappkey/login


With headers accept:application/json;charset=utf-8

Authorization: Basic base64(kid_myappkey:Appsecret)


With Body :

{

 "username":"value",

 "password":"value"

}

I've followed the instructions I get this error :


{

 "error": "IncompleteRequestBody",

 "description": "The request body is either missing or incomplete",

 "debug": "The body of the request is missing credentials required to login"

}

Just for future reference, as this was resolved on a different channel:

The client was only sending an "accept: application/json;charset=utf-8" header, but no "Content-Type: application/json" header. Therefore the server was unable to interpret the body payload and threw the, admittedly ambiguous, error below:

 

{
    "error": "IncompleteRequestBody",
    "description": "The request body is either missing or incomplete",
    "debug": "The body of the request is missing credentials required to login"
}

 


So the resolution is: As documented, always include the Content-Type header in order for the server to be able to interpret the request.

Login or Signup to post a comment