1

我直接从文档中编写代码,但它就像完全忽略了回调函数的存在:

var jsforce = require('jsforce');
var conn = new jsforce.Connection({
  // you can change loginUrl to connect to sandbox or prerelease env.
  loginUrl : 'https://ivytechfoundation--ucidev.my.salesforce.com'
});
conn.login('xxxxxx@ivytech.edu.uci.ucidev', 'xxxxxxxxTOjhPejiRZ1KWox4AmYOPzqu', function(err, userInfo) {
   console.error('1');
  // if (err) { return console.error(err); }
  console.error(err);
  console.error(userInfo);

  // Now you can get the access token and instance URL information.
  // Save them to establish connection next time.
  console.log(conn.accessToken);
  console.log(conn.instanceUrl);
  // logged in user property
  console.log("User ID: " + userInfo.id);
  console.log("Org ID: " + userInfo.organizationId);
  // ...
});

有任何想法吗?它永远不会达到“1”

4

1 回答 1

0

似乎有一个错误。我也不能让它工作,但这有效:

conn
      .login(sfUserName, sfPassword + sfToken)
      .then((userInfo) => { // your code here
于 2021-05-16T02:56:06.660 回答