Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does node-adwords support login-customer-id new requirement? #93

Open
Nastromo opened this issue Feb 1, 2019 · 1 comment
Open

Does node-adwords support login-customer-id new requirement? #93

Nastromo opened this issue Feb 1, 2019 · 1 comment

Comments

@Nastromo
Copy link

Nastromo commented Feb 1, 2019

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:\'&lt;null&gt;\']</faultstring>
			<detail>
				<ApiExceptionFault
					xmlns="https://adwords.google.com/api/adwords/cm/v201809">
					<message>[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:\'&lt;null&gt;\']</message>
					<ApplicationException.Type>ApiException</ApplicationException.Type>
					<errors
						xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AuthorizationError">
						<fieldPath></fieldPath>
						<trigger>&lt;null&gt;</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?

@Nastromo
Copy link
Author

Nastromo commented Feb 1, 2019

Was my mistake! Authenticate one account and tried to make mutate on another. But the question about login-customer-id is still need to be checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant