通过 Web 应用程序编辑 google 个日历

Editing google calendar through web application

我有一个应用程序需要自动将事件添加到 google 日历。问题是应用程序的所有用户都无法访问 google 日历,因此无法要求他们授予对应用程序的访问权限。

有没有办法在不询问当前用户的情况下授予 API 访问 google 日历的权限?或者可能只进行一次身份验证并存储该身份验证?

我确定它在 Google 文档的某处有所介绍,但我似乎无法找到我正在查看的情况的答案。

谢谢! 本

授权信息可以保存在文件系统中,后续执行不会提示授权。检查此 documentation to know how to perform authorization in a web application. Here is an example 如何将凭据存储到系统。

// Store the credentials to disk.    
    if(!file_exists(dirname($credentialsPath))) {
          mkdir(dirname($credentialsPath), 0700, true);
        }
        file_put_contents($credentialsPath, $accessToken);
        printf("Credentials saved to %s\n", $credentialsPath);
      }
      $client->setAccessToken($accessToken);