尝试使用此代码向 Google Ads API 发送事件后:
UploadClickConversionsResponse response =
conversionUploadService.UploadClickConversions(
new UploadClickConversionsRequest()
{
CustomerId = customerId.ToString(),
Conversions = { clickConversion },
PartialFailure = true,
ValidateOnly = false
});
我收到消息:
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", ......
之后,我尝试使用 ServiceAccountCredential 请求令牌,该令牌在此函数中返回“true”:
credential.RequestAccessTokenAsync(CancellationToken.None).Result;
但是还是不行。 谁能解释一下我如何配置 refresh_token 并将其与 UploadClickConversions 一起发送?
他们说我应该使用 app.config 中的配置,但我使用的是 net core 3.1,配置文件是 appsettings.json。
我完全被困住了。谢谢。