2

I am trying to fetch Youtube comments, but it's throwing this exception -

{"Google.Apis.Requests.RequestError\r\nInsufficient Permission: Request had insufficient authentication scopes. [403]\r\nErrors [\r\n\tMessage[Insufficient Permission: Request had insufficient authentication scopes.] Location[ - ] Reason[insufficientPermissions] Domain[global]\r\n]\r\n"}

The credential source code -

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; 

this is the line where it's throwing exception -

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(); if (searchCommentThreadlistResponse.Result.Items.Count > 0){ }

Could you please help ?

Anindita Ghatak
  • 163
  • 1
  • 3
  • 8

1 Answers1

0

I am able to fix it with this scope - enter image description here

Anindita Ghatak
  • 163
  • 1
  • 3
  • 8