Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Logging in to Salesforce with JSForce

I am using the JSForce docs in order to create a Javascript app to connect to my Salesforce org. My code is as follows:

var jsforce = require('jsforce');
var conn = new jsforce.Connection({
    loginUrl : 'https://test.salesforce.com'
});

var username = 'my-username@domain.com';
var password = 'mypassword';


conn.login(username, password, function(err, userInfo) {
    if (err) { return console.error(err); }
    console.log(conn.accessToken);
    console.log(conn.instanceUrl);
    console.log("User ID: " + userInfo.id);
    console.log("Org ID: " + userInfo.organizationId);
  });

However, when I run it, it appears to do nothing at all. I would expact to see either the access token etc to be logged to indicate success, or an error to indicate failure. But nothing is logged at all.

When I check the login history on my Salesforce org, I can see the attempts, they are successful.

What's going on?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The answer is simple. The instructions are for jsforce v1.x, but I had jsforce 2.x (beta). Fixed by doing this:

npm install jsforce@1.11.0
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!