为什么我的 Google Drive Refresh Token 在 7 天后过期?

Why my Google Drive Refresh Token is expiring after 7 days?

我实现了一个 Laravel 网络应用程序,其中 Google 驱动器的 API 用于存储。 我使用了本教程 https://gist.github.com/sergomet/f234cc7a8351352170eb547cccd65011。 我注意到在我的应用程序中,“刷新令牌”每 7 天过期一次,我不知道为什么。我在 Google 开发人员控制台中的应用程序处于“测试”模式。

这里有一些文档说明为什么 Google 刷新令牌可能不起作用:https://developers.google.com/identity/protocols/oauth2/#expiration。您应该将可能无效的令牌考虑到您的应用程序中。

我在这里找到了关于您的问题的回复:

在文档中 https://developers.google.com/identity/protocols/oauth2#expiration 有作者:

A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days.

因此您必须尝试在“OAuth 同意屏幕”中发布它。