Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. invalid_grant: authentication failure
  2.  
  3. var oauth2 = {
  4.  
  5. // NEW TEST ENVIRONMENT
  6. //loginUrl : 'https://ap2.salesforce.com', // /services/oauth2/token',
  7. //clientId : 'XXX',
  8. //clientSecret : 'XXX',
  9. //redirectUri : 'http://localhost'
  10.  
  11. // SANDBOX
  12. loginUrl : 'https://cs87.salesforce.com', // /services/oauth2/token',
  13. clientId : 'XXX',
  14. clientSecret : 'XXX',
  15. redirectUri : 'http://localhost'
  16.  
  17. // PROD
  18. //loginUrl : 'https://login.salesforce.com', // /services/oauth2/token',
  19. //clientId : 'XXX',
  20. //clientSecret : 'XXX',
  21. //redirectUri : 'http://localhost'
  22.  
  23. }
  24.  
  25.  
  26.  
  27. var config = {
  28. // NEW TEST
  29. //username : 'XXX@XX.com',
  30. //password : 'Password'
  31.  
  32. // NEW TEST
  33. username : 'XXX@XX.com',
  34. password : 'Password' (Have tried combination of single password + with security token)
  35.  
  36. // PROD
  37. //username : 'XXX@XXX.com',
  38. //password : PASSWORD+SecurityToken
  39.  
  40. }
  41.  
  42.  
  43. app.get('/login', function(req, res) {
  44.  
  45. var conn = new jsforce.Connection({
  46. oauth2
  47. });
  48. conn.login(config.username, config.password, function(err, userInfo) {
  49. if (err) { return console.error(err); }
  50. // Now you can get the access token and instance URL information.
  51. // Save them to establish connection next time.
  52. console.log(conn.accessToken);
  53. console.log(conn.instanceUrl);
  54. // logged in user property
  55. console.log("User ID: " + userInfo.id);
  56. console.log("Org ID: " + userInfo.organizationId);
  57. // ...
  58. });
  59. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement