相关疑难解决方法(0)

Google Calendar API 返回 invalid_grant 和错误的请求

在我的开发环境中,我有一个用户,我刚刚收到了以下范围的 OAuth 令牌。

一切看起来都很好,我为用户存储了令牌。然后我请求列出用户的日历,我得到了无效请求的无效请求。我使用另一个用户的令牌(也在我的开发环境中)尝试相同的请求,并且它工作正常。

我最初只有第一个范围设置,即写级别访问。这就是所有现有令牌的创建方式。在我的测试过程中,我添加了其他范围。

我尝试在我的项目中更新 Google API 的 NuGet 包。

这是我的班级正在打电话。

public class GoogleCalendarAdapter : ICalendarAdapter {
    #region attributes
    private readonly ISiteAuthTokenQueryRepository _tokenRepo;
    private readonly GoogleCalendarSettings        _settings;

    private const string APPNAME = "REDACTED";

    private const string ACL_OWNER = "owner";
    private const string ACL_WRITER = "writer";
    #endregion

    #region ctor
    public GoogleCalendarAdapter(ISiteAuthTokenQueryRepository tokenRepo,
                                 GoogleCalendarSettings        settings) {
        _tokenRepo = tokenRepo;
        _settings  = settings;
    }
    #endregion

    #region methods
    private GoogleAuthorizationCodeFlow BuildAuthorizationCodeFlow() {
        return new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer() {
            ClientSecrets = BuildClientSecrets(), …
Run Code Online (Sandbox Code Playgroud)

c# google-calendar-api

5
推荐指数
1
解决办法
483
查看次数

标签 统计

c# ×1

google-calendar-api ×1