Google Drive (Service Account) icon

Google Drive (Service Account)

Access Google Drive API using Service Account

Overview

This node allows users to create permissions on Google Drive files using a service account for authentication. It supports both credential-based and manual authentication methods. Users can specify the file ID, the role to grant (e.g., owner, reader), the type of grantee (user, group, domain, anyone), and additional options such as sending notification emails with custom messages. This node is useful for automating access control on Google Drive files, such as sharing files with specific users or groups programmatically.

Use Case Examples

  1. Automatically share a file with a team member by creating a 'writer' permission for their email address.
  2. Grant read-only access to a file for all users in a specific domain.
  3. Send a custom notification email when sharing a file with a new user.

Properties

Name Meaning
Authentication Choose the authentication method: use saved credentials or enter them manually.
Service Account Email The email address of the service account used for authentication (required if manual authentication is selected).
Private Key The private key from the service account JSON used for authentication (required if manual authentication is selected).
Impersonate Email (Optional) Email of the user to impersonate, requires domain-wide delegation (optional).
File ID The ID of the Google Drive file to which the permission will be applied.
Role The role granted by this permission, such as owner, writer, or reader.
Type The type of the grantee receiving the permission, such as user, group, domain, or anyone.
Email Address Email address of the user or group to grant permission to (required if type is user or group).
Domain The domain name to grant permission to (required if type is domain).
Options Additional options for the permission creation, such as sending a notification email and including a custom message.

Output

JSON

  • json
    • type - The type of the grantee (user, group, domain, anyone).
    • role - The role granted by the permission (owner, writer, reader, etc.).
    • emailAddress - The email address of the user or group (if applicable).
    • domain - The domain name (if applicable).
    • id - The unique ID of the created permission.

Dependencies

  • Google Drive API via googleapis library
  • Service account credentials or manual authentication details

Troubleshooting

  • Ensure that the service account has the necessary permissions to manage file permissions on Google Drive.
  • If using manual authentication, verify that the private key is correctly formatted and includes proper newline characters.
  • Errors related to missing or invalid credentials indicate that the authentication details are incorrect or incomplete.
  • Permission creation may fail if the file ID is invalid or the authenticated account lacks access to the file.

Links

Discussion