Hi,

I am trying to run the example using the new Google Ads API from here: 
https://developers.google.com/google-ads/api/docs/client-libs/java/getting-started
 but 
am facing an exception. 

*Command Run*: ./gradlew -q runExample 
--example="basicoperations.GetCampaigns --customerId 6676419890"

*Response:*

Running example: 
com.google.ads.googleads.examples.basicoperations.GetCampaigns, args: 
[--customerId, 6676419890]

2022-09-07 10:07:04,309 WARN  [grpc-default-executor-0] 
logging.RequestLogger (RequestLogger.java:159) - FAILURE REQUEST SUMMARY. 
Method: google.ads.googleads.v11.services.GoogleAdsService/SearchStream, 
Endpoint: googleads.googleapis.com:443, CustomerID: 6676419890, RequestID: 
null, ResponseCode: PERMISSION_DENIED, Fault: Request had insufficient 
authentication scopes..

2022-09-07 10:07:05,273 INFO  [grpc-default-executor-0] 
logging.RequestLogger (RequestLogger.java:157) - FAILURE REQUEST DETAIL.

Request

-------

MethodName: google.ads.googleads.v11.services.GoogleAdsService/SearchStream

Endpoint: googleads.googleapis.com:443

Headers: {developer-token=REDACTED, login-customer-id=3258658280, 
x-goog-api-client=gl-java/1.8.0_292 gccl/21.0.1-SNAPSHOT 
gapic/21.0.1-SNAPSHOT gax/2.12.2 grpc/1.44.1 pb/3.19.4}

Body: customer_id: "6676419890"

query: "SELECT campaign.id, campaign.name FROM campaign ORDER BY 
campaign.id"


Response

--------

Headers: Metadata(content-type=application/grpc,www-authenticate=Bearer 
realm="https://accounts.google.com/";, error="insufficient_scope", 
scope="https://www.googleapis.com/auth/adwords 
https://adwords.google.com/api/adwords 
https://adwords.google.com/api/adwords/ 
https://adwords.google.com/api/adwords/cm",x-google-session-info=GgQYECgLIAE6GhIYZ29vZ2xlYWRzLmdvb2dsZWFwaXMuY29t,date=Wed,
 
07 Sep 2022 17:07:04 
GMT,x-google-gfe-request-trace=acsfol15:443,dydl21:9838,/bns/py/borg/py/bns/adwords-simply/aw-webapi-esfproxy-prod.server/54,dydl21:9838,acsfol15:443,x-google-gfe-version=2.790.1,x-google-gslb-service=adwords-frontend-webapi-esfproxy,x-google-backends=/bns/py/borg/py/bns/adwords-simply/aw-webapi-esfproxy-prod.server/54,/bns/dy/borg/dy/bns/traffic-prod/shared-layer2-gfe/19,/bns/dy/borg/dy/bns/traffic-prod/shared-layer2-gfe/19,/bns/ncsfoa/borg/ncsfoa/bns/gfe-prod/blue-layer1-gfe.sfo03s25/4,x-google-dos-service-trace=main:adwords-frontend-webapi-esfproxy,main:shared-layer2-gfe,x-google-gfe-handshake-trace=GFE:
 
/bns/ncsfoa/borg/ncsfoa/bns/gfe-prod/blue-layer1-gfe.sfo03s25/4,Mentat 
oracle: 
[2002:a05:7308:7195::]:9846,x-google-service=adwords-frontend-webapi-esfproxy,shared-layer2-grpc-aggregate,x-google-gfe-response-code-details-trace=response_code_set_by_backend,response_code_set_by_backend,x-google-gfe-response-body-transformations=chunked,chunked,x-google-shellfish-status=CA0gBEBG,alt-svc=h3=":443";
 
ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; 
ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; 
ma=2592000,quic=":443"; ma=2592000; 
v="46,43",x-google-gfe-service-trace=adwords-frontend-webapi-esfproxy,shared-layer2-grpc-aggregate)

Body: null

Failure message: null

Status: Status{code=PERMISSION_DENIED, description=Request had insufficient 
authentication scopes., cause=null}.

Exception in thread "main" 
com.google.api.gax.rpc.PermissionDeniedException: 
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Request had insufficient 
authentication scopes.

        at 
com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:53)

        at 
com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)

        at 
com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)

        at 
com.google.api.gax.grpc.ExceptionResponseObserver.onErrorImpl(ExceptionResponseObserver.java:82)

        at 
com.google.api.gax.rpc.StateCheckingResponseObserver.onError(StateCheckingResponseObserver.java:86)

        at 
com.google.api.gax.grpc.GrpcDirectStreamController$ResponseObserverAdapter.onClose(GrpcDirectStreamController.java:149)

        at 
io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)

        at 
io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)

        at 
io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)

        at 
com.google.api.gax.grpc.ChannelPool$ReleasingClientCall$1.onClose(ChannelPool.java:455)

        at 
io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)

        at 
io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)

        at 
io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)

        at 
com.google.ads.googleads.lib.logging.LoggingInterceptor$1$1.onClose(LoggingInterceptor.java:113)

        at 
io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463)

        at 
io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427)

        at 
io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460)

        at 
io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)

        at 
io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)

        at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)

        at 
io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)

        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)

        at 
io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)

        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:748)

        Suppressed: java.lang.RuntimeException: Asynchronous task failed

                at 
com.google.api.gax.rpc.ServerStreamIterator.hasNext(ServerStreamIterator.java:105)

                at 
com.google.ads.googleads.examples.basicoperations.GetCampaigns.runExample(GetCampaigns.java:102)

                at 
com.google.ads.googleads.examples.basicoperations.GetCampaigns.main(GetCampaigns.java:62)

Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Request had 
insufficient authentication scopes.

        at io.grpc.Status.asRuntimeException(Status.java:535)

        ... 21 more


According to one of the answers on the forum (
https://groups.google.com/g/adwords-api/c/PQPc0lOJCws), I should be using a 
non-manager account to make API calls. I tried that too but get the same 
error. Thank you!

Regards,
Shivani Katukota

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/237f2781-6a80-4508-96b1-6d60dde4f4d1n%40googlegroups.com.

Reply via email to