1

I am using PHP FuelSDK installed with composer. I followed this guide to create the clientid and clientsecret:

http://www.calvinfroedge.com/salesforce-how-to-generate-api-credentials/

Here is my code:

require COMPOSER_DIR . 'autoload.php';

use FuelSdk\ET_Client;
use FuelSdk\ET_List;

$config = array(
    'appsignature'            => 'none',
    'clientid'                => 'XXX',
    'clientsecret'            => 'XXX',
    'defaultwsdl'             => 'https://webservice.exacttarget.com/etframework.wsdl',
    'xmlloc'                  => '/var/www/html/playground/salesforce/composer/vendor/salesforce-mc/fuel-sdk-php/ExactTargetWSDL.xml',
    'baseUrl'                 => 'https://www.exacttargetapis.com',
    'baseAuthUrl'             => 'https://auth.exacttargetapis.com',
    'baseSoapUrl'             => 'https://webservice.exacttarget.com/Service.asmx',
    'useOAuth2Authentication' => false,
);

$myclient = new ET_Client(true, true, $config);

$request = new ET_List();
$request->authStub = $client;
$response = $request->get();

print_r($response);

All I am trying to do right now is connect to my Salesforce Sandbox using the connect app I created. I am getting this error:

Fatal error: Uncaught Exception: Unable to validate App Keys(ClientID/ClientSecret) provided.: Unable to validate App Keys(ClientID/ClientSecret) provided, requestToken response:{"message":"Unauthorized","errorcode":1,"documentation":""} in /var/www/html/playground/salesforce/composer/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php:320 Stack trace: #0 /var/www/html/playground/salesforce/composer/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php(215): FuelSdk\ET_Client->refreshToken() #1 /var/www/html/playground/salesforce/index.php(43): FuelSdk\ET_Client->__construct(true, true, Array) #2 {main} thrown in /var/www/html/playground/salesforce/composer/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php on line 320

I know the keys work as I ran this curl command as the guide suggested and I got a successful response back:

$cmd = 'curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id='.$config['clientid'].'" -d "client_secret='.$config['clientsecret'].'" -d "username=XXX" -d "password=XXX"';
exec($cmd, $result);

What am I missing in setting up the SDK? I feel like I am missing something very simple and I am not finding it.

0

So the link you provided is not for the marketing cloud its for the salesforce. You should follow this doc: Create and Install Packages for getting a clientid/secret for Marketing Cloud

I would also recommend starting with the oAuth 2.0 authentication (you can't create a legacy package anyway) and using TSE (Tenant Specific Endpoints)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.