2

I am new to SalesForce and Heroku platform. I am trying to explore and learn as much as possible.

I have developed React app and deployed to Heroku. Its working as expected, but I am at a stage where I am suppose to make Rest API call to Salesforce and get data from SalesForce Object.

I tried jsforce, nforce plugins to connect to Salesforce and fetch data. But unable to.

I used Postman to connect to SalesForce, I am able to connect. But I am getting error when I am trying to connect to Salesforce through code stating (400 bad request).

I have enable CORS on my environment (sandbox). Please let me know if I am missing some configuration settings, it will be really helpful.

var org = nforce.createConnection({
  clientId:
    "3MVG9sLbBxQYwWqvgNjn4MAlHFib10UPpW1IV7IDsN55vY7xaljuzUxvnsVrk",
  clientSecret:
    "F762DF566D8B29455F54EC8176CBC19C54CBE953517AC",
  redirectUri: "https://www.google.com/",
  environment: "sandbox",
  mode: "single",
  autoRefresh: true
});

let creds = {
  username: username,
  password: password + securityToken
};

org.authenticate(creds, function(err, resp) {
  if (!err) {
    console.log("Access Token: " + resp.access_token);
    oauth = resp;
  } else {
    console.log(err);
  }
});

And below is the error which I am getting:

enter image description here

salah9
  • 502
  • 1
  • 10
  • 21

0 Answers0