salesforce-marketingcloud / FuelSDK-PHP

FuelSDK-PHP
MIT License
134 stars 142 forks source link

OAuth error on SOAP request #178

Open jmares79 opened 1 year ago

jmares79 commented 1 year ago

Hi all, for an internal project I need to perform a Data extract. For that I've been following the SDK docs and trying to connect via SOAP.

The issue is that when trying to authenticate with OAuth FALSE, I receive a message as:

"Unable to validate App Keys(ClientID/ClientSecret) provided.: Unable to validate App Keys(ClientID/ClientSecret) provided, requestToken response:{"message":"This integration is not eligible to use the legacy /v1/requestToken endpoint because the integration uses enhanced OAuth 2.0 functionality. To obtain a token for this integration, use the applicable Marketing Cloud OAuth 2.0 endpoint for authentication. For a web or public app, use /v2/authorize and then /v2/token. For a server-to-server integration, use /v2/token.","errorcode":10007,"documentation":""}"

It looks like, from the issues, only OAuth is valid to authenticate now, but I'm not sure how to obtain a token and, even if I can get one, how to use the token with "ET_Client" SOAP class.

Am I missing some steps? The code I'm using to try to create the client is: $client = new ET_Client( false, true, array( 'appsignature' => 'none', 'clientid' => <CLIENT_ID>, 'clientsecret' => <CLIENT_SECRET>, 'defaultwsdl' => 'https://webservice.exacttarget.com/etframework.wsdl', 'baseAuthUrl' => '<URL>', 'baseSoapUrl' => '<SOAP_URL>', 'baseUrl' => '<REST_URL>', 'xmlloc' => <path_to_a_downloaded_WSDL>, 'useOAuth2Authentication' => false, 'proxyhost' => <MY_PROXY>, 'proxyport' =><PORT> ) );

Thanks!

garek007 commented 1 year ago

I have some working code, but it looks like you are close, and the readme should have some good sample code. Did you try it with the v2 endpoint? One of the things that has tripped me up in the past was the WSDL location. Make sure your path to that is correct. I have downloaded it in the past and modified the path.