We're trying to use the JSforce library (http://jsforce.github.io/) for javascript access to the salesforce api but we keep getting "invalid_grant" errors when trying to authenticate
<script src="//cdnjs.cloudflare.com/ajax/libs/jsforce/1.1.2/jsforce.min.js"></script>
<script>
var conn = new jsforce.Connection({
oauth2 : {
clientId : CLIENTID,
clientSecret : CLIENTSECRET,
redirectUri : REDIRECTURI,
instanceUrl : 'http://test.salesforce.com'
},
});
conn.login(USERNAME, PASSWORD, function(err, res) {
if (err) { return console.error(err); }
conn.query('SELECT Id, Name FROM Account', function(err, res) {
if (err) { return console.error(err); }
console.log(res);
});
});
</script>
Even trying to do a simple curl request and we are still getting invalid grant
curl https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=CLIENTID" -d "client_secret=SECRET" -d "username=USERNAME" -d "password=PASSWORD"
We triple checked all the logins and ids and everything is correct? any ideas?
Attribution to: Keith Mancuso
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32231