BingAds / BingAds-PHP-SDK

Other
56 stars 45 forks source link

what could be authorizationData for CustomerManagementService. #138

Closed chiragvels closed 3 years ago

chiragvels commented 4 years ago

Hi,

I am using like this

$authentication = (new OAuthDesktopMobileAuthCodeGrant())
                            ->withClientId($clientID)
                            ->withClientSecret($clientSecret);

                $authorizationData = (new AuthorizationData())
                        ->withAuthentication($authentication)
                        ->withDeveloperToken($dev_token);

                $customerManagementProxy = new ServiceClient(
                        ServiceClientType::CustomerManagementVersion13,
                        $authorizationData,
                       'Production'
                );

                $getAccountsInfoResponse = $this->getAccountsInfo($customerManagementProxy,
                                null,
                                false
                );

and i have read that CustomerManagementService is not required to pass accountId or CustomerId along with authorizationData.

Error received is

Fault Code: s:Server Fault String: Invalid client data. Check the SOAP fault details for more information. TrackingId: a35d4762-1f9b-42f0-96b4-b80702a23386. Fault Detail:

Last SOAP request/response: https://clientcenter.api.bingads.microsoft.com/Api/CustomerManagement/v13/CustomerManagementService.svc?singleWsdl

false

s:ServerInvalid client data. Check the SOAP fault details for more information. TrackingId: a35d4762-1f9b-42f0-96b4-b80702a23386.a35d4762-1f9b-42f0-96b4-b80702a23386 105InvalidCredentialsAuthentication failed. Either supplied credentials are invalid or the account is inactive

I am sure that the validation is correct and passed credential are validated correctly.

Could you please help?

chiragvels commented 4 years ago

It is solved. I need to pass refresh token as well

$authorizationData->Authentication->RequestOAuthTokensByRefreshToken($details['refresh_token']);