Ramco Ramco

Ramco Ramco

  • 419
  • 3.4k
  • 528.2k

Error - The service youtube has thrown an exception. Invalid Credentia

Dec 13 2022 3:25 AM

Hi

 I am trying using APi , how it can be done using OAuth 2.0. I am trying to get subscribers list.

On searchrequest.execute i am gettig error.

using (var yt = new YouTubeService(new BaseClientService.Initializer()
            {
                ApiKey = "API Key",
            }))
            {
                StringBuilder htmlTable = new StringBuilder();

                var searchRequest = yt.Subscriptions.List("subscriberSnippet");
                searchRequest.ChannelId = "Channel Id";
                searchRequest.MySubscribers = true;
                var searchResponse = searchRequest.Execute();
                var objResult = searchResponse.Items.ToList();
}