Posts under category Google

I'm using oAuth2.0 flow to work with Google Ads API. I ran in a problem today that when doing an API Request I'm getting the following 401 error:

UNAUTHENTICATED: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. 

On the headers of each google ads request I add

   {"Content-Type", "application/json"},    {"Accept", "application/json"},    {"User-Agent", "Mozilla/5.0 (Macintosh; ..."},    {"Authorization", "Bearer $ACCESS_TOKEN"},    {"developer-token", "$DEVELOPER_TOKEN"},    {"login-customer-id", "$LOGIN_CUSTOMER_ID"} 

I've already tried to generate a new access_token, since my automatically process of generating new access_tokens when the current one expired could be failing, but it wasn't the case. I managed to create a new valid access token and it continues to give the same error. The scope used when fist granted permissions to the app was "https://www.googleapis.com/auth/adwords".

Did anyone fall into the same problem?

I'm trying to run the keyword stats report (file found here: https://github.com/googleads/google-ads-python/blob/master/examples/reporting/get_keyword_stats.py) via the Google Ads API. I have the googleads.yaml file setup already. But when I run the report, I'm getting an error that says:

ValueError: A required field in the configuration data was not found. The required fields are: ('developer_token',) 

I have all the required fields in my googleads.yaml file. Please see screenshot below for reference. What could have gone wrong in my code? Why is it not reading the 'developer_token' I have in the googleads.yaml file?

i am using java library client for web application authentication, i produce authorization url using client secret and client id,also i provided a redirect url within google api console,but i don't know if it is necessary for me to create this server to receive refresh token? i mean in production i should provide a separate server to receive the refresh token?(redirect url comes to this server) the main problem is user should paste the produced url on browser by himself but i want to open browser authmaticly , the second one is about reciving the refresh token i am not sure about creating another server to recieve refreshcode and i can't use service accounts i am going with web flow authentication.

 UserAuthorizer userAuthorizer =                 UserAuthorizer.newBuilder()                         .setClientId(ClientId.of(clientId, clientSecret))                         .setScopes(SCOPES)                         .setCallbackUri(URI.create(OAUTH2_CALLBACK_URL_CONFIGURED_AT_GOOGLE_CONSOLE))                         .build();         baseUri = URI.create("http://localhost:" + simpleCallbackServer.getLocalPort());         System.out.printf(                 "Paste this url in your browser:%n%s%n",                 userAuthorizer.getAuthorizationUrl(loginEmailAddressHint, state, baseUri)); 

and this is local server to receive refresh token:

private static class SimpleCallbackServer extends ServerSocket {         private AuthorizationResponse authorizationResponse;         SimpleCallbackServer() throws IOException {             // Passes a port # of zero so that a port will be automatically allocated.             super(0);         }         /**          * Blocks until a connection is made to this server. After this method completes, the          * authorizationResponse of this server will be set, provided the request line is in the          * expected format.          */         @Override         public Socket accept() throws IOException {             Socket socket = super.accept();         } } 

I want to fetch ad group performance report with two demographics, gender and age_range, also with other metrics. So I used gender_view with query body below, but found the information of age_range are all "UNSPECIFIED". By the way, age_range_view is the same result which the information of gender are all "UNSPECIFIED".

SELECT     segments.date,     campaign.name,     ad_group.name,     ad_group_criterion.criterion_id,     ad_group_criterion.age_range.type,     ad_group_criterion.gender.type,     metrics.impressions,     metrics.clicks,     metrics.cost_micros,      metrics.conversions FROM age_range_view WHERE segments.date BETWEEN "2021-01-01" AND "2021-04-30" 

Is there any good method to query?

I've been struggling to integrate google ads in the flutter app. It keeps crashing.

Installed version: google_mobile_ads: ^0.12.1+1

I've updated the manifest too with the ads meta-data

<meta-data             android:name="com.google.android.gms.ads.APPLICATION_ID"             android:value="<AD-CODE>" /> 

Whenever I try to debug the code on the emulator. I get these errors in the console:

Launching lib/main.dart on sdk gphone x86 arm in debug mode... ✓ Built build/app/outputs/flutter-apk/app-debug.apk. E/AndroidRuntime(23372): FATAL EXCEPTION: main E/AndroidRuntime(23372): Process: com.example.kavya_digest, PID: 23372 E/AndroidRuntime(23372): java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: E/AndroidRuntime(23372): E/AndroidRuntime(23372): ****************************************************************************** E/AndroidRuntime(23372): * Invalid application ID. Follow instructions here:                          * E/AndroidRuntime(23372): * https://googlemobileadssdk.page.link/admob-android-update-manifest         * E/AndroidRuntime(23372): * to find your app ID.                                                       * E/AndroidRuntime(23372): ****************************************************************************** E/AndroidRuntime(23372): E/AndroidRuntime(23372): E/AndroidRuntime(23372):    at android.app.ActivityThread.installProvider(ActivityThread.java:7135) E/AndroidRuntime(23372):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6675) E/AndroidRuntime(23372):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6592) E/AndroidRuntime(23372):    at android.app.ActivityThread.access$1300(ActivityThread.java:233) E/AndroidRuntime(23372):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896) E/AndroidRuntime(23372):    at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(23372):    at android.os.Looper.loop(Looper.java:223) E/AndroidRuntime(23372):    at android.app.ActivityThread.main(ActivityThread.java:7523) E/AndroidRuntime(23372):    at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(23372):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/AndroidRuntime(23372):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941) E/AndroidRuntime(23372): Caused by: java.lang.IllegalStateException: E/AndroidRuntime(23372): E/AndroidRuntime(23372): ****************************************************************************** E/AndroidRuntime(23372): * Invalid application ID. Follow instructions here:                          * E/AndroidRuntime(23372): * https://googlemobileadssdk.page.link/admob-android-update-manifest         * E/AndroidRuntime(23372): * to find your app ID.                                                       * E/AndroidRuntime(23372): ****************************************************************************** E/AndroidRuntime(23372): E/AndroidRuntime(23372): E/AndroidRuntime(23372):    at com.google.android.gms.internal.ads.zzzt.attachInfo(com.google.android.gms:play-services-ads-lite@@19.7.0:24) E/AndroidRuntime(23372):    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.7.0:3) E/AndroidRuntime(23372):    at android.app.ActivityThread.installProvider(ActivityThread.java:7130) E/AndroidRuntime(23372):    ... 10 more Exited