Google日历API同步令牌无效怎么办?

What to do when Google Calendar API sync token is invalid?

在 Google 日历 API 的文档中,它是这样说的:

Sometimes sync tokens are invalidated by the server, for various reasons including token expiration or changes in related ACLs. In such cases, the server will respond to an incremental request with a response code 410. This should trigger a full wipe of the client’s store and a new full sync.

我系统中的很多同步令牌都失效了,我不知道为什么。我在很多日历上都收到此错误:

(410) Sync token is no longer valid, a full sync is required.

我能做些什么来防止这种情况发生或重新验证同步令牌而不强制用户登录并重新连接到他的日历。目前很不方便。

正确处理与重新登录等无关。问题是此同步令牌无法再为您提供本地存储的内容与服务器上的内容之间的正确差异。因此,建议您清除本地存储中的事件并发送完全同步请求(这意味着没有同步令牌的列表请求)。您可以继续使用相同的身份验证令牌。