My understanding is for the "OAuth 2.0 Web Server Flow for Web App Integration" you only need the client_id and the client_secret to get an OAuth Token. We tried that like this:
$this->restforce = new Restforce(
$salesforce_credentials['client_id'],
$salesforce_credentials['client_secret'],
NULL,
NULL,
NULL,
$salesforce_credentials['api_version'],
$salesforce_credentials['instance_url'],
);
That throws this exception:
PHP Fatal error: Uncaught EventFarm\Restforce\RestforceException: Restforce needs either an OAuthToken or User/PW combo to start authenticate in vendor/eventfarm/restforcephp/src/RestforceException.php:15
Stack trace:
#0 vendor/eventfarm/restforcephp/src/Restforce.php(48): EventFarm\Restforce\RestforceException::minimumRequiredFieldsNotMet()
#1 salesforce/SalesforceApi.php(21): EventFarm\Restforce\Restforce->__construct()
#2 foo.php(19): Salesforce\SalesforceApi->getRestforceClient()
#3 [internal function]: test_function()
But, if we take out this check in vendor/eventfarm/restforcephp/src/Restforce.php, then everything works fine:
if ($accessToken === null && $username === null && $password === null) {
throw RestforceException::minimumRequiredFieldsNotMet();
}
You don't need to start with an access token to use this flow to authenticate with Salesforce, so I'm not sure why that parameter is required.