C#Youtube频道列表API抛出权限不足[403]

时间:2018-12-29 00:40:23

标签: c# youtube-api youtube-data-api youtube-analytics-api

我收到的凭据json的格式如下:

{
    "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"]
}

它抛出了错误:

  

“无法将System.String强制转换或转换为   Google.Apis.Auth.OAuth2.GoogleClientSecrets”

我将其包装在{"web":{json}}内并尝试过,但是现在抛出了:

  

Google.Apis.Requests.RequestError-权限不足[403]   错误[消息[权限不足]位置[-]   原因[insufficientPermissions]域[全局]]}

我正在使用以下范围

YouTubeAnalyticsService.Scope.YtAnalyticsReadonlyYouTubeAnalyticsService.Scope.YtAnalyticsMonetaryReadonlyYouTubeService.Scope.YoutubeForceSslYouTubeService.Scope.Youtube

在创建凭据时,但是现在,它在.Execute()处被破坏

YouTubeService youtubeService = AnalyticsLoggingHelper.GetYoutubeService(channelinfo);
var channelResourcesList = youtubeService.Channels.List("contentDetails");
channelResourcesList.Id = channelinfo.ChannelId;
var listResult = channelResourcesList.Execute();

0 个答案:

没有答案