【问题标题】:"Access Denied" error on Google Auth API for CalendarGoogle Auth API for Calendar 出现“拒绝访问”错误
【发布时间】:2017-06-20 18:05:48
【问题描述】:

从昨天开始,我一直在尝试验证我对 de Google Calendar V3 API 的请求以便使用它,但我无法通过仅包含文本“拒绝访问”的 AggregateException。

我的冲突代码是这样的,最后一行是中断的:

UserCredential credential;

using (var stream =
            new FileStream(HostingEnvironment.MapPath(credentialsPath), FileMode.Open, FileAccess.Read))
        {
            string credPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            credPath = Path.Combine(credPath, writePath);

            var authTask = GoogleWebAuthorizationBroker.AuthorizeAsync(
                GoogleClientSecrets.Load(stream).Secrets,
                Scopes,
                "user",
                CancellationToken.None,
                new FileDataStore(credPath, true)
            );

            credential = authTask.Result;
        }

我已经尝试重新创建密钥,再次生成 client_secret.json 文件,创建另一个凭据...我也知道 JSON 和文件夹这两个路径都是正确的,因为我必须在达到此之前解决这个问题错误。

关于可能是什么问题的任何提示? 谢谢!

【问题讨论】:

  • 根据您的 DNN 设置,您可能从未使用正确的用户或 IIS 用户权限配置您的网站,以便将新数据资产保存到您的服务器上。

标签: asp.net json google-calendar-api dotnetnuke google-authentication


【解决方案1】:

由于Invalid Credentials,通常会遇到“拒绝访问”错误。

以下是您可以尝试的建议操作:

  • 使用长期刷新令牌获取新的访问令牌。
  • 如果失败,请引导用户完成 OAuth 流程,如Authorizing requests with OAuth 2.0 中所述。
  • 如果您在服务帐户中看到此信息,请检查您是否已成功完成 service account page 中的所有步骤。

希望有帮助!

【讨论】:

    猜你喜欢
    • 2017-02-16
    • 2016-08-22
    • 2014-07-07
    • 2015-01-05
    • 1970-01-01
    • 2012-01-22
    • 1970-01-01
    • 2016-05-05
    • 1970-01-01
    相关资源
    最近更新 更多