The credential json I have received was in this format:
{
"token": "test token",
"refresh_token": "test refresh",
"token_uri": "test uri",
"client_id": "test client id",
"client_secret": "test client sec",
"scopes": ["https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/youtubepartner", "https://www.googleapis.com/auth/yt-analytics-monetary.readonly", "https://www.googleapis.com/auth/yt-analytics.readonly"]
}
It was throwing the error:
"Could not cast or convert from System.String to Google.Apis.Auth.OAuth2.GoogleClientSecrets"
I wrapped it inside {"web":{json}}
and tried, but now it's throwing:
Google.Apis.Requests.RequestError - Insufficient Permission [403] Errors [Message[Insufficient Permission] Location[ - ] Reason[insufficientPermissions] Domain[global]]}
I am using following scopes
YouTubeAnalyticsService.Scope.YtAnalyticsReadonly
, YouTubeAnalyticsService.Scope.YtAnalyticsMonetaryReadonly
, YouTubeService.Scope.YoutubeForceSsl
, YouTubeService.Scope.Youtube
while creating credential, but now, it's breaking at .Execute()
YouTubeService youtubeService = AnalyticsLoggingHelper.GetYoutubeService(channelinfo);
var channelResourcesList = youtubeService.Channels.List("contentDetails");
channelResourcesList.Id = channelinfo.ChannelId;
var listResult = channelResourcesList.Execute();