无法使用C#获取Youtube品牌帐户的凭据

时间:2019-06-03 22:31:05

标签: google-api youtube youtube-api youtube-data-api youtube-analytics-api

我正在尝试获取youtube品牌帐户的凭据,但它仅停留在授权页面上。 这是代码-

   string[] scopes = new string[] { "https://www.googleapis.com/auth/youtube", "https://www.googleapis.com/auth/youtube.force-ssl", "https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/youtube.upload", "https://www.googleapis.com/auth/youtubepartner", "https://www.googleapis.com/auth/youtubepartner-channel-audit", "https://www.googleapis.com/auth/youtube.upload" };
        UserCredential credentials;
        Console.WriteLine("Requesting authorization");

        using (var stream = new FileStream(Path.Combine(Environment.CurrentDirectory, channelinfo.SecretFileName), FileMode.Open, FileAccess.Read))
        {
            credentials = GoogleWebAuthorizationBroker.AuthorizeAsync(
                GoogleClientSecrets.Load(stream).Secrets,
                scopes,
                "user",
                CancellationToken.None,
                new FileDataStore(Directory.GetCurrentDirectory() + "\\AccessToken\\" + channelinfo.AnalyticsAPIFileDataStore, true)).Result;
        }

,当我们传递用户ID和品牌帐户的密码后,它始终显示401。你能帮忙吗?

0 个答案:

没有答案