admin管理员组文章数量:1387278
I've been trying to setup a program that will access a Google Docs file, specifically it should generate PDFs from a template document that is hosted on a shared Drive. This would be easy if I just needed to do it manually with OAuth, however I need this to run for the business without human intervention. To do that, I gather I should use a service account.
The problem is that I can't seem to grant the required permissions to the service account. I can't find any option to add permissions for Google Drive/Docs files to the service account. When giving "Owner" permissions, the program using the service account credentials still throws a 403 "the caller does not have permission" error.
I believe I could give delegation permissions for the service account to impersonate anybody within the anisation, and then it could use that to access the files, but that seems like overkill. I just want to access documents in a specific Drive folder. Is there a better way to get the permissions I need?
I've been trying to setup a program that will access a Google Docs file, specifically it should generate PDFs from a template document that is hosted on a shared Drive. This would be easy if I just needed to do it manually with OAuth, however I need this to run for the business without human intervention. To do that, I gather I should use a service account.
The problem is that I can't seem to grant the required permissions to the service account. I can't find any option to add permissions for Google Drive/Docs files to the service account. When giving "Owner" permissions, the program using the service account credentials still throws a 403 "the caller does not have permission" error.
I believe I could give delegation permissions for the service account to impersonate anybody within the anisation, and then it could use that to access the files, but that seems like overkill. I just want to access documents in a specific Drive folder. Is there a better way to get the permissions I need?
Share Improve this question edited Mar 17 at 20:42 PatrickdC 2,6192 gold badges9 silver badges30 bronze badges asked Mar 17 at 17:27 Rainbow-Anthony LilicoRainbow-Anthony Lilico 1057 bronze badges 2 |1 Answer
Reset to default 0Found a reasonable solution for my specific use case thanks to @dazwilkin - I can share a document or folder with a service account through its email in the same way I would share with a human. Other use cases might require domain wide delegation.
本文标签: How to access Google document via service accountStack Overflow
版权声明:本文标题:How to access Google document via service account - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744543461a2611752.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
{account}@{project}.iam.gserviceaccount
) with the document as if it were a human user. It will gain the permission that you assign to it when you do this. – DazWilkin Commented Mar 17 at 17:59