我正在尝试获得动态链接统计通过动态链接分析API与方法FirebaseDynamicLinksService.V1.GetLinkStats()...我能够很容易地创建一个简短的链接,它的工作…但问题是要获得关于这个动态链接的统计数据。
我得到了403:"Google.Apis.Requests.RequestError调用者没有权限403错误[MessageThe调用者没有权限位置-原因禁止的域全局]“
我是不是漏掉了什么?我试着遵循这个https://firebase.google.com/docs/reference/dynamic-links/analytics
我的代码基本上是这样的:
var googleCredential = GoogleCredential.FromFile(shortLinkServiceConfiguration.KeyFileName).CreateScoped($"https://www.googleapis.com/auth/firebase");
var dynamicLinksService = new FirebaseDynamicLinksService(new Google.Apis.Services.BaseClientService.Initializer
{
HttpClientInitializer = googleCredential,
ApplicationName = shortLinkServiceConfiguration.ApplicationName
});
var request = dynamicLinksService.ShortLinks.Create(createShortDynamicLinkRequest);
request.AccessToken = googleCredential.UnderlyingCredential.GetAccessTokenForRequestAsync().Result;
// This works and I get the short link
var response = request.Execute();
var secondRequest = dynamicLinksService.V1.GetLinkStats(response.ShortLink);
secondRequest.AccessToken = googleCredential.UnderlyingCredential.GetAccessTokenForRequestAsync().Result;
secondRequest.DurationDays = 7;
// This does not work and I get 403
var secondResponse = secondRequest.Execute();发布于 2019-09-02 18:24:46
有了这里的帮助:https://github.com/googleapis/google-api-dotnet-client/issues/1448
已通过在服务帐户中添加"Firebase Grow“角色解决此问题...
https://stackoverflow.com/questions/57745445
复制相似问题