Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- invalid_grant: authentication failure
- var oauth2 = {
- // NEW TEST ENVIRONMENT
- //loginUrl : 'https://ap2.salesforce.com', // /services/oauth2/token',
- //clientId : 'XXX',
- //clientSecret : 'XXX',
- //redirectUri : 'http://localhost'
- // SANDBOX
- loginUrl : 'https://cs87.salesforce.com', // /services/oauth2/token',
- clientId : 'XXX',
- clientSecret : 'XXX',
- redirectUri : 'http://localhost'
- // PROD
- //loginUrl : 'https://login.salesforce.com', // /services/oauth2/token',
- //clientId : 'XXX',
- //clientSecret : 'XXX',
- //redirectUri : 'http://localhost'
- }
- var config = {
- // NEW TEST
- //username : 'XXX@XX.com',
- //password : 'Password'
- // NEW TEST
- username : 'XXX@XX.com',
- password : 'Password' (Have tried combination of single password + with security token)
- // PROD
- //username : 'XXX@XXX.com',
- //password : PASSWORD+SecurityToken
- }
- app.get('/login', function(req, res) {
- var conn = new jsforce.Connection({
- oauth2
- });
- conn.login(config.username, config.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);
- // ...
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement