Created
April 8, 2019 20:44
-
-
Save amineds/b33d391ea1a403ac7cd54dad981bef62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsforce = require('jsforce'); | |
var conn = new jsforce.Connection({ | |
oauth2 : { | |
// you can change loginUrl to connect to sandbox or prerelease env. | |
loginUrl : 'https://test.salesforce.com', | |
clientId : '3MVG9T46ZAw5GTfUAOzUzNDlh9exRS6m94PR1.o95_Q6t.qo8vFZkGOI_oAm3maz3oWLZ9K8Tdb1HTmVYev6a', | |
clientSecret : 'DD7FE38C376FA2575F3BAFC9980CC879CFB10E84BD55FA72E426DFABCC509119', | |
redirectUri : 'http://localhost:3000' | |
} | |
}); | |
conn.login('[email protected]', 'password', function(err, userInfo) { | |
if (err) { return console.error(err); } | |
// 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); | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment