Start a new topic

BL custom endpoint only returns {}

I have done a BL custom endpoint:


function onRequest(request, response, modules){

  var logger = modules.logger;

  var uriString = 'https://api.molt.in/oauth/access_token';

  var opts = {

    uri: uriString,

    method: 'post',

    form: {

      "Content-Type": "multipart/form-data",

      "grant_type": "client_credentials",

      "client_id":"xxxxxx",

      "client_secret": "xxxxx"

    },

    json:true

  };

  modules.request.request(opts, function( err, resp, body ) {

    if (err) {

      response.body = err;

    } else {

       response.complete();

       logger.info(response.body);

       }

  });

}



I get back a 200 SUCCESS -- {} 


but no content in the body. 


When I test with Postman accesing Moltin on my mac I get this back:


{"access_token""ccffffxxxxxx","token_type""Bearer","identifier""client_credentials","expires"1428840550,"expires_in"3600}


Could it be that Kinvey does not understand the response?


1 Comment

Solved!