Google Ads Api service account authentication net core 3

313 views
Skip to first unread message

Andrey Lima

unread,
Feb 17, 2021, 1:16:26 PM2/17/21
to AdWords API and Google Ads API Forum
After trying to send an event to Google Ads Api with this code:

                UploadClickConversionsResponse response =
                    conversionUploadService.UploadClickConversions(
                        new UploadClickConversionsRequest()
                        {
                            CustomerId = customerId.ToString(),
                            Conversions = { clickConversion },
                            PartialFailure = true,
                            ValidateOnly = false
                        });


I got the message:
RpcException: Status(StatusCode="Unavailable", Detail="Getting metadata from plugin failed with error: Exception occurred in metadata credentials plugin. Google.Apis.Auth.OAuth2.Responses.TokenResponseException: Error:"invalid_request", Description:"Missing required parameter: refresh_token",  ...... 


After that I've tried to request the token using ServiceAccountCredential wich returned "true" in this function:
credential.RequestAccessTokenAsync(CancellationToken.None).Result;


But still doesn't work.
Could anyone explain me how can I configure the refresh_token and send it with the UploadClickConversions?

I'm totally stuck. Thanks.

Andrey Lima

unread,
Feb 17, 2021, 2:09:14 PM2/17/21
to AdWords API and Google Ads API Forum
At this link 
https://github.com/googleads/googleads-dotnet-lib/wiki/API-access-using-own-credentials-(server-to-server-flow)#step-2---setting-up-the-client-library

They say that I should use the config at the app.config, but I'm using net core 3.1 and the cofiguration file is appsettings.json.

Google Ads API Forum Advisor Prod

unread,
Feb 18, 2021, 1:43:20 AM2/18/21
to andre...@gmail.com, adwor...@googlegroups.com
Hi Andrey,

Thanks for posting your concern.

If you are trying to setup dotnet client library of Google ads API, then you should config the client library at app.config file. If you have further questions on the appsettings.json configuration file, then I would suggest to post your concern on this channel to get support from the author of the client library.

Also, the link that you've mentioned is for AdWords API. Since you are trying to integrate Google Ads API client library, then I would suggest following the documents below instead:
Moving forward to your question about uploading click conversion, then I would suggest referring to this document to read more information about about implementing it in Google Ads API.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2CS681:ref
Reply all
Reply to author
Forward
0 new messages