Guest User

Untitled

a guest
Jul 16th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. {
  2. "connections": {
  3. "<my_username>": {
  4. "accessToken": "<my_accessToken>",
  5. "instanceUrl": "<https://my.partial.instance.com>",
  6. "client": "default"
  7. }
  8. },
  9. "clients": {
  10. "default": {
  11. "clientId": "<myclientid>",
  12. "clientSecret": "<longNumber>",
  13. "redirectUri": "https://localhost:1111",
  14. "loginUrl": "https://test.salesforce.com"
  15. }
  16. }
  17. }
  18.  
  19. var jsforce = require('jsforce');
  20. var conn = new jsforce.Connection({
  21. oauth2 : {
  22. // you can change loginUrl to connect to sandbox or prerelease env.
  23. loginUrl : 'https://test.salesforce.com',
  24. clientId : '<myclientid>',
  25. clientSecret : '<longNumber>',
  26. redirectUri : '<https://my.partial.instance.com>'
  27. }
  28. });
  29. conn.login(username, 'password'+'<id>', function(err, userInfo) {
  30. if (err) { return console.error(err); }
  31. // Now you can get the access token and instance URL information.
  32. // Save them to establish connection next time.
  33. console.log(conn.accessToken);
  34. console.log(conn.instanceUrl);
  35. // logged in user property
  36. console.log("User ID: " + userInfo.id);
  37. console.log("Org ID: " + userInfo.organizationId);
  38. // ...
  39. });
Add Comment
Please, Sign In to add comment