Drive service account - view files from another account

I have successfully created a Google Drive service account and can create files via PHP for this account. However, I need to be able to view these created files from the Google web interface from other user accounts. How to allow other users access to these automatically created files?

thanks

+8
google-drive-sdk
source share
3 answers

You just need to share the file with the right users:

https://developers.google.com/drive/v2/reference/permissions/insert

+6
source share

One option is to fulfill domain credentials for a Google domain: https://developers.google.com/drive/web/delegation

+1
source share

Jay is in place. Check out the API v3 guide and reference permission. My other advice would be to first create a folder and set its permissions, which are then inherited by any child files, for example. in Python (sorry, I don't know PHP!):

# Folder setup folder_metadata = { 'name': 'Searchable folder name', 'mimeType': 'application/vnd.google-apps.folder' } folder = drive_service.files().create( body=folder_metadata, ).execute() domain_permission = { 'type': 'domain', 'role': 'reader', 'domain': 'example.com', 'allowFileDiscovery': True, # so they show up in user searches } drive_service.permissions().create( fileId=folder['id'], body=domain_permission, ).execute() # New files body = { 'name': 'Searchable filename', 'parents': [folder['id']], } drive_service.files().create( media_body=..., body=body, ).execute() 
0
source share

All Articles