I can't get Google Adwords Customers Campagin inform
I want to build a web application. Clients can use the web application to read their google Adwrods accounts information( campagins or budgets ).
First, I use oath2 get client's refresh_token and access_token. Using the refresh_token, I can get all adwords id under the client by (https://github.com/googleads/google-ads-ruby)
client = Google::Ads::GoogleAds::GoogleAdsClient.new do |config| config.client_id = "client_id" config.client_secret = "client_secret" config.refresh_token = "refresh_token" config.login_customer_id = "XXX-XXX-XXXX" config.developer_token = "XXXXXXXXXXXXXXXX" end accessible_customers = client.service.customer.list_accessible_customers().resource_names
When I want to get client Adword account information,
resource_name = client.path.customer("XXXXXXXX") customer = client.service.customer.get_customer(resource_name: resource_name)
I get "GRPC::Unauthenticated: 16:Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential", but the config file can't let me set access_token.
So, where can i set client's access_token, or which step i missed?
The error is telling you that client has not been set up correctly. It could be a bunch of issues from Google account to wrong information. I would check and make sure all the info you are passing in Google::Ads::GoogleAds::GoogleAdsClient.new is correct.
Also, you only need to pass 'login_customer_id' for manager accounts only, it doesn't sound like you are a manager account.
From https://github.com/googleads/google-ads-ruby/blob/master/google_ads_config.rb
# Required for manager accounts only: Specify the login customer ID used to # authenticate API calls. This will be the customer ID of the authenticated # manager account. If you need to use different values for this field, then # make sure fetch a new copy of the service after each time you change the # value. # c.login_customer_id = 'INSERT_LOGIN_CUSTOMER_ID_HERE'Hi @nzajt , I passed my adwords manager account id to the login_customer_id, didn't it?
By the way, my developer_token is my adwords manager account's developer_token