-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
I'm getting an error USER_PERMISSION_DENIED when I try to mutate. My users login through OAuth2. I get refresh and access tokens which I use to create adwords user. And I then use it with service mutate method (my code belowe). Why I get this error?
Accordingly to this:
https://groups.google.com/forum/#!searchin/adwords-api/USER_PERMISSION_DENIED|sort:date/adwords-api/v-oad5Md5J4/srUaj_ffFgAJ
We have to put new parameter in header to make valid request.
This change starts from February 11th 2019.
For now I get an error with this code:
router.get('/block', errorHandler(async (req, res, next) => {
res.sendStatus(200);
const user = new AdwordsUser({
developerToken: process.env.developerToken,
userAgent: process.env.userAgent,
clientCustomerId: 'xxx-xxx-xxxx',
client_id: process.env.client_id,
client_secret: process.env.client_secret,
refresh_token: tokenObj.refresh_token,
access_token: tokenObj.access_token,
debug: true,
});
const campaignCriterionService = user.getService('CampaignCriterionService');
const operation = {
operator: 'ADD',
operand: {
campaignId: 111111111,
criterion: {
type: 'IP_BLOCK',
'xsi:type': 'IpBlock',
ipAddress: '77.77.77.77',
},
'xsi:type': 'NegativeCampaignCriterion'
}
};
campaignCriterionService.mutate({ operations: [operation] }, async (error, result) => {
// console.log(error, result);
});
})
);
My error:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader
xmlns="https://adwords.google.com/api/adwords/cm/v201809">
<requestId>000580d199108c1b0ac7c46abe0473e3</requestId>
<serviceName>CampaignCriterionService</serviceName>
<methodName>mutate</methodName>
<operations>1</operations>
<responseTime>92</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:\'<null>\']</faultstring>
<detail>
<ApiExceptionFault
xmlns="https://adwords.google.com/api/adwords/cm/v201809">
<message>[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:\'<null>\']</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthorizationError">
<fieldPath></fieldPath>
<trigger><null></trigger>
<errorString>AuthorizationError.USER_PERMISSION_DENIED</errorString>
<ApiError.Type>AuthorizationError</ApiError.Type>
<reason>USER_PERMISSION_DENIED</reason>
</errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Maybe it's related to new requirement? Or am I doing something wrong?
Metadata
Metadata
Assignees
Labels
No labels