我已閱讀了大部分開發人員控制檯參考。403查詢YouTube Analytics API .NET時返回了禁止的錯誤
- 我在Google Developers Console中的YouTube網站的「YouTube管理器Google帳戶」下創建了一個安裝的項目。
- 我已啓用YouTube數據API v3和YouTube Analytics v1。
- 我已經爲安裝的項目創建了一個憑證。
的代碼沒有問題,驗證:
UserCredential credential;
using (var stream = new FileStream(hds_opo_youtube_service.Properties.Settings.Default.clientIDFile, FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows for read-only access to the authenticated
// user's account, but not other types of account access.
new[] { YouTubeService.Scope.YoutubeReadonly,
YouTubeAnalyticsService.Scope.YtAnalyticsReadonly},
"user",
CancellationToken.None,
new FileDataStore(this.GetType().ToString())
);
}
var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = this.GetType().ToString()
});
中出現錯誤:Google.Apis.Requests.RequestError故宮[403] 錯誤[ 留言[功夫] 位置[ - ] 原因[禁止] 域[全球] ]
我試圖解決使用API Explorer的情況。這非常有幫助。當我嘗試使用YouTube管理員所有者個人資料帳戶進行身份驗證時。查詢失敗。但是,如果我使用不同的Google+信息頁帳戶,我可以使查詢生效。 Google+信息頁帳戶有一個電子郵件帳戶,但所有與Google+信息頁帳戶的通信都會直接發送到經理所有者個人資料帳戶。所以我嘗試將Google+信息頁帳戶添加到項目權限中,但無法確認鏈接。我認爲我的問題是YouTube頻道歸Google+信息頁帳戶所有。經理擁有者擁有不同的帳戶和個人資料帳戶,即使它是YouTube帳戶的經理。我知道這聽起來很混亂。有沒有人對如何解決問題有任何想法。謝謝