Reputation: 983
I'm trying to create a Google service account which has access to a Drive folder so I can use google-spreadsheets to read and write to files in the folder. During development I created a service account under my unmanaged Google account. The user account has owner access. In order to be allowed access I needed to change the document sharing settings to public (with link access). For development this is no issue, but of course in production I do not want my data to be publicly accessible.
How do I make sure the service account has access to the document while it is not publicly shared (shared within organisation is preferred)? Setting it to organisation access only, the api gives me a 403 (Forbidden) code.
Upvotes: 1
Views: 1740
Reputation: 116958
Service accounts are dummy users. You can take the service account email address and share a folder on your personal drive account with the service account. Give it write access and it will be able to read and write to this folder.
Just remember that when uploading to this folder you will need to have the service account grant your personal user access to the file or your going to have files on your drive account that you dont own and cant access.
Upvotes: 5