gpt4 book ai didi

youtube - YouTube评论API引发 “Insufficient Permission: Request had insufficient authentication scopes”错误

转载 作者:行者123 更新时间:2023-12-03 05:34:58 36 4
gpt4 key购买 nike

我正在尝试获取Youtube的评论,但它引发了此异常-

{“Google.Apis.Requests.RequestError \ r \ n权限不足:请求的身份验证范围不足。[403] \ r \ nErrors [\ r \ n \ tMessage [权限不足:请求的身份验证范围不足。]位置[-]原因[insufficientPermissions]域[全局] \ 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
});

var searchCommentThreadlistRequest = youtubeServiceComments.CommentThreads.List(“snippet”);
var searchCommentThreadlistResponse = searchCommentThreadlistRequest.ExecuteAsync();
如果( searchCommentThreadlistResponse.Result.Items.Count > 0){
}

能否请你帮忙 ?

最佳答案

我可以在此范围内修复它-enter image description here

关于youtube - YouTube评论API引发 “Insufficient Permission: Request had insufficient authentication scopes”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56139729/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com