Do all GRPC services use the same verification method?

88 views
Skip to first unread message

knepp harr

unread,
Jan 8, 2024, 10:19:17 PM1/8/24
to Google Ads API and AdWords API Forum
Hi I use the same ClientConn to send a request, one of which is successful, but the other fails

The prompt when it failed was :
```bash
rpc error: code = Unauthenticated desc = 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.
```
This is my code:
```go
headers := metadata.Pairs(
"authorization", "Bearer "+accessToken,
"developer-token", developerToken,
"login-customer-id", customerID,
)
ctx := context.Background()
ctx = metadata.NewOutgoingContext(ctx, headers)

cred := grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""))
conn, err := grpc.Dial("googleads.googleapis.com:443", cred)
```

```go
customerServiceClient := services.NewCustomerServiceClient(conn)
accessibleCustomers, err := customerServiceClient.ListAccessibleCustomers(
ctx,
&services.ListAccessibleCustomersRequest{},
)
```
I can get the correct return information from ListaccessibleCustomers

```go
campaignServiceClient := services.NewCampaignServiceClient(conn)
campaigns, err := campaignServiceClient.MutateCampaigns(ctx, campaign)
```
Campaign objects have been created in the code
Mutatecampaigns will prompt me to lack authentication

Is there a different verification method different interface?

Thanks!

Google Ads API Forum Advisor

unread,
Jan 9, 2024, 2:04:22 AM1/9/24
to anderse...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your concern, I understand that you encounter an "Unauthenticated" error for one API request, while the other request succeeds. Kindly note that all the GRPC services use the same verification method while authenticating. I would recommend you to kindly refer to the "Ensuring connectivity" documentation for more information. 

In order to investigate your issue further, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rVSkq:ref"

Thanks,
 
Google Logo Google Ads API Team

 

Reply all
Reply to author
Forward
0 new messages