我正在尝试获取Youtube评论,但它抛出了这个异常-
{"Google.Apis.Requests.RequestError\r\nInsufficient权限:请求的身份验证范围不足。403\r\n错误[\r\n\t消息权限不足:请求的身份验证范围不足。Location - ReasoninsufficientPermissions域全局\r\n]\r\n“}
凭据源代码-
UserCredential credsDataApi = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { YouTubeService.Scope.YoutubeForceSsl, YouTubeService.Scope.Youtubepartner, YouTubeAnalyticsService.Scope.YtAnalyticsReadonly, YouTubeAnalyticsService.Scope.YtAnalyticsMonetaryReadonly, YouTubeAnalyticsService.Scope.Youtube, "https://www.googleapis.com/auth/plus.login" },
"user",
CancellationToken.None,
new FileDataStore(Directory.GetCurrentDirectory() + "\\MetadataAccessToken\\" + channelinfo.DataAPIFileDataStore, true)
).Result;
这就是抛出异常的那一行-
UserCredential credsDataApi = YouTubeHelper.GetUserCredentialForDataAPI(channelinfo);
var youtubeServiceComments = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credsDataApi,
ApplicationName = channelinfo.DataAPIFileDataStore
});
如果(searchCommentThreadlistResponse.Result.Items.Count >0,则var searchCommentThreadlistRequest = var var searchCommentThreadlistResponse = searchCommentThreadlistRequest.ExecuteAsync();){}
你能帮帮忙吗?
发布于 2019-05-15 07:47:33
我可以用这个范围来修复它-
https://stackoverflow.com/questions/56139729
复制相似问题