Hello guys,
I'm developing an integration with you guys, basically the functionality I want to achieve is that my clients use my tool to add users to their remarketing lists.
To do that I've implemented the oauth flow and registered for the google api.
I'm storing the clientId, clientSecret and Adwords developer token (test for now), in my server, and then storing refresh tokens for each user who go through the oauth flow.
When i need some data from Google Apis, I run the code at the end of the post and then get the services needed.
Most of the times I get correct responses, but some times I get AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED, like this one:
<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:ResponseHeader
xmlns="
https://adwords.google.com/api/adwords/cm/v201710"
xmlns:ns2="
https://adwords.google.com/api/adwords/rm/v201710">
<requestId>00055ef91cc02b680a81118635009f51</requestId>
<serviceName>AdwordsUserListService</serviceName>
<methodName>get</methodName>
<operations>1</operations>
<responseTime>48</responseTime>
</ns2:ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @
; trigger:'<null>']</faultstring>
<detail>
<ns2:ApiExceptionFault
xmlns="
https://adwords.google.com/api/adwords/cm/v201710"
xmlns:ns2="
https://adwords.google.com/api/adwords/rm/v201710">
<message>[AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ;
trigger:'<null>']</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthenticationError">
<fieldPath/>
<trigger><null></trigger>
<errorString>AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED</errorString>
<ApiError.Type>AuthenticationError</ApiError.Type>
<reason>CLIENT_CUSTOMER_ID_IS_REQUIRED</reason>
</errors>
</ns2:ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
private AdWordsSession initSession(String refreshToken) throws ValidationException, OAuthException {
Credential credential = new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.withClientSecrets(clientId, clientSecret)
.withRefreshToken(refreshToken)
.build()
.generateCredential();
// Create a new AdWordsSession without using a properties file.
return new AdWordsSession.Builder()
.withDeveloperToken(developerToken)
.withOAuth2Credential(credential)
.build();
}
Any help will be appreciated.