简体   繁体   English

Google API服务帐户 - 无法访问私人数据

[英]Google API Service Account - Can't Access Private Data

Trying to access my personal calendar data using a service account. 尝试使用服务帐户访问我的个人日历数据。

I've gone through the setup for creating a service account (with owner permissions). 我已经完成了创建服务帐户的设置(具有所有者权限)。 Using NodeJS, I've successfully made requests to my public calendar, but not my private calendars. 使用NodeJS,我已成功向我的公共日历发出请求,但不是我的私人日历。 ( the same result using googleapis and google-OAuth-jwt packages) (使用googleapisgoogle-OAuth-jwt软件包的结果相同)

Everything that I've searched shows that I need to give "domain-wide authority", BUT, I do not have a G Suite account, so I don't believe this applies to me. 我搜索过的所有内容都显示我需要提供“域范围权限”,但我没有G Suite帐户,所以我不相信这适用于我。

So the question is, can one access their own personal calendar data using a service account? 所以问题是,可以使用服务帐户访问自己的个人日历数据吗? What might I be missing? 我可能会失踪什么?

Answer in comments, thanks to abielita . 回答评论,感谢abielita Link to answer . 链接回答

Remember service accounts are not you. 记住服务帐户不是你。 The service account has its own Google calendar account so if you are trying to read one of your personal calendars you are going to have to share it with the service account. 该服务帐户拥有自己的Google日历帐户,因此,如果您尝试阅读其中一个个人日历,则必须与服务帐户共享。

Shared the calendar with my service account. 与我的服务帐户共享日历。

You may refer with this SO post . 你可以参考这篇SO帖子 It stated that the service account has its on Google calendar account so if you are trying to read one of your personal calendars, you are going to share it with the service account. 它表示该服务帐户具有Google日历帐户,因此,如果您尝试阅读其中一个个人日历,则表示您将与该服务帐户共享该帐户。 You can check the example given using the Json service account key file . 您可以使用Json服务帐户密钥文件检查给出的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM