Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Unable to make SalesForce REST API call using nforce #189

Open
salahsaleh opened this issue Jan 14, 2020 · 0 comments
Open

Unable to make SalesForce REST API call using nforce #189

salahsaleh opened this issue Jan 14, 2020 · 0 comments

Comments

@salahsaleh
Copy link

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:

herokuIssue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant