Salesforce datasource - Invalid grant


Symptoms

Executing SOQL queries shows:

Error code: Invalid_grant

Error message: Authentication failure ...



Cause

This error occurs for those reasons:

  1. Wrong URL in datasource base URL field
  2. IP restriction or login hour restriction
  3. Invalid user credentials or user profile has no 'API Enabled' option

Resolution

  1. In Elements Connect datasource configuration check if you set your real domain name url, available from Salesforce Settings / Company Settings / My Domain
  2. if those restrictions are enabled, try disabling them and try again to authenticate
  3. User should have the API permission enabled in the profile configuration: Setup User -> click on profile -> Administrative Permissions -> API Enabled