'Google Drive - Access Drive without consent form (Username/password known)

I've been reading on Google Drive's API which seems straight-forward enough, but I'd like to use it a bit differently.

Instead of a client-side application, I need to be able to batch copy files in a given directory on a server to a specific Google Drive account which I have control over. To elaborate, I'm implementing a scan-to-email feature in which a user can scan a document on our copier which is then copied to that Google Drive account.

This is done for internal users, so the accounts would be generic and there would be no reasons to change the passwords. Is this possible at all?



Solution 1:[1]

I would recommend you go with a service account. Think of a service account as a user, a service account will have its own drive account. You will be able to upload the files to it, and your application wont be required to login as it will have the login built into it. You will not be able to login and see the files for this account via the web interface.

In order for the users to access the files again you have a few options.

  1. You can then set the permissions on the files to allow the different users to access the files via there google drive accounts. Google drive api permissions
  2. you could create your own interface and use files list to list the files that are currently stored on the service account.

Heads up:

You will at some point want to know how much space the service account drive has left. use about.get

Google has a number of client libs that can make doing all of this quite easy. but you haven't said what language you are planning on doing this in.

Solution 2:[2]

You could rely on the insert method of the "File" resource within the API. This will allow you to create a Google Drive File with the file type based on the scanned file. Refer to this document for examples and further assistance: https://developers.google.com/drive/v2/reference/files/insert#examples https://developers.google.com/drive/web/manage-uploads

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DaImTo
Solution 2 Rivero