2

I am using Jforce to connect to my developer account using oAuth. But i am getting error.

This XML file does not appear to have any style information associated with it. The document tree is shown below. grant type not supported unsupported_grant_type

<!DOCTYPE html>
<html>
<head>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jsforce/1.5.0/jsforce.min.js"></script>
  <script>
jsforce.browser.init({
  clientId: '3MVG9Y6d_Btp4xp7Zjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5WZd4GG',
  redirectUri: 'https://ap1.salesforce.com/services/oauth2/token'

});
jsforce.browser.on('connect', function(conn) {
  conn.query('SELECT Id, Name FROM Account', function(err, res) {
    if (err) { return console.error(err); }
    console.log(res);
  });
});
  </script>
</head>
<body>
  <button onclick="javascript:jsforce.browser.login();">Login</button>
</body>
</html>
  • Are you running the above page from a website? That's how the above code was intended to run. See Getting Started at the link you provided. You may want to use the CLI interface to connect instead if trying to connect directly from your machine. Otherwise, I think you'll first need to set-up OAuth on your DevOrg and use the log-in pop-up option. – crmprogdev Aug 15 '15 at 19:16
  • Thanks@crmprogdev.. Yes i am running above page from a website and i have already setup oAuth in DevOrg...still i am getting error. – MIX DML Aug 16 '15 at 6:15
  • Does your web site require an OAuth log-in? If not, that may be what the "unsupported_grant_type" error message is telling you. – crmprogdev Aug 16 '15 at 16:11
  • My website does not require OAuth login...but as per documentation it says we can access the data from salesforce using the above code. – MIX DML Aug 17 '15 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.