I've seen several posts online regarding this error but no clear answer.

When trying to create a new campaign, I get the below error.

Google::Ads::GoogleAds::Errors::GoogleAdsError(Google::Ads::GoogleAds::Errors::GoogleAdsError):
 
Unauthorized CREATE operation in invoking a service's mutate method.

The line points to this line of code:

return_budget = client.service.campaign_budget.mutate_campaign_budgets(
customer_id: customer_id,
operations: [operation],
)

I have all the proper permissions from my understanding. I have a basic 
access developer token, and I created a project and added Oauth 
credentials, and generated a refresh token with access to manage Ads. This 
is how I'm initializing Google Ads in the application and creating a 
campaign_budget. The code is a template I've modified from the github page 
for this Ruby gem <https://github.com/googleads/google-ads-ruby/>. I've 
redacted the actual values.

//

client = Google::Ads::GoogleAds::GoogleAdsClient.new do |config|

config.login_customer_id = '6947334XXX'
config.developer_token = 'XXX'
config.client_id = 'XXX'
config.client_secret = 'XXX'
config.refresh_token = 'XXX'
config.log_level = 'DEBUG'
config.log_target = STDOUT
config.treat_deprecation_warnings_as_errors = false
config.warn_on_all_deprecations = false
end

campaign_budget = client.resource.campaign_budget do |cb|
cb.name = "#{@place.full_name} Budget"
cb.delivery_method = :STANDARD
cb.amount_micros = 10000000
end

operation = 
client.operation.create_resource.campaign_budget(campaign_budget)

# Add budget.
return_budget = client.service.campaign_budget.mutate_campaign_budgets(
customer_id: customer_id,
operations: [operation],
)

//

Here is the full response when I try to create a campaign:

W, [2021-04-19T23:34:01.400542 #1]  WARN -- : CID: 6947334835, Host: 
googleads.googleapis.com:443, Method: 
/google.ads.googleads.v6.services.CampaignBudgetService/MutateCampaignBudgets, 
IsFault: yes

I, [2021-04-19T23:34:01.400813 #1]  INFO -- : Outgoing request: Headers: 
{"developer-token":"REDACTED","login-customer-id":"XXX","x-goog-api-client":"gl-ruby/2.6.5
 
gax/0.3.4 gapic/10.0.0 
grpc/1.36.0","x-goog-request-params":"customer_id=XXX"} Payload: 
{"customerId":"XXX","operations":[{"create":{"name":"Las Vegas, NV, United 
States Budget","amountMicros":"10000000","deliveryMethod":"STANDARD"}}]}

I, [2021-04-19T23:34:01.400971 #1]  INFO -- : Incoming response (errors): 

  
Google::Ads::GoogleAds::Errors::GoogleAdsError(Google::Ads::GoogleAds::Errors::GoogleAdsError):
 
Unauthorized CREATE operation in invoking a service's mutate method.

 called from: 
/usr/src/trip_tippa/app/services/find_new_advisors_service.rb:39:in 
`add_campaigns'

Google::Ads::GoogleAds::Errors::GoogleAdsError: 
Google::Ads::GoogleAds::Errors::GoogleAdsError

from 
/usr/local/bundle/gems/google-ads-googleads-10.0.0/lib/google/ads/google_ads/interceptors/error_interceptor.rb:67:in
 
`rescue in request_response'

Thanks for looking into this. Let me know if you need anything else.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/9ff56649-6653-4a66-b725-d73d1e97bc7en%40googlegroups.com.

Reply via email to