Handle google drives service account limit of 15Gb

harshal jadhav
2 min readJul 4, 2022

A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.

Typically a user will create a folder in his drive and share it with a service account for data upload.

When you upload files to google drive using service accounts, the storage limit is counted against the service account itself and not the user's account.

Suppose your email id is user@gmail.com and the service account’s email id is serviceaccountemail@gmail.com, below illustration shows the drive’s storage consumption.

Now, I was using a google workspace account that had almost unlimited storage for each and every user in my workspace, but the service account has only 15 Gbs. Hence it cannot upload more than 15 Gb of files despite the fact that I have unlimited storage.

After digging deep into the google documentation I came across domain-wide delegation. It is one of the ways by which you can delegate additional access rights to a service account.

Delegate domain-wide authority to your service account

  1. From your Google Workspace domain’s Admin console, go to the Main menu> Security > Access and data control > API controls.
  2. In the Domain-wide delegation pane, select Manage Domain Wide Delegation.
  3. Click Add new.
  4. In the Client ID field, enter the client ID obtained from the service account creation steps above.
  5. In the OAuth Scopes field, enter a comma-delimited list of the scopes required for your application (for a list of possible scopes, see Authorize requests).
  6. For example, if you require domain-wide access to Users and Groups enter: https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.group
  7. Click Authorize.

Your service account now has domain-wide access to the Google Admin SDK Directory API for all the users of your domain. You are ready to instantiate an authorized Admin SDK Directory service object on behalf of your Google Workspace domain’s users.

Here is the detailed link from google https://developers.google.com/admin-sdk/directory/v1/guides/delegation

--

--