Search code examples
google-drive-apigoogle-appsgoogle-picker

External asp.net mvc application accessing files on Google Drive


I would like to build an external asp.net mvc application that has the following features:

  • The application is accessible via its own domain such as www.itsowndomain.com
  • The application has access to one Google account (such as [email protected]) where all the files are stored in the Drive folder. So the users of the application should not have to log into their own Google accounts in order to access the files from this application. The application needs to have automatic access to this ([email protected])'s google Drive, that process should be transparent to the user, they should never have to authenticate themselves, its should all happen in the code in the background when the application loads.
  • The application will use Google Picker to list the files that are in ([email protected])'s google Drive folder.

My questions are as follows:

  1. Is what I am trying to do possible, basically using Google Drive as a storage of files and downloading them, uploading new ones and possible editing some from an external application?
  2. Can I use one account because all the files should be publicly available so I do not want users to have to be thinking about authentication in a site just so they can view publicly accessible files?
  3. How do I go about implementing this, is there a tutorial because the ones I have looked at all differ as they mostly try authenticate each user with their own Google account?

Solution

    1. you can use Google Drive as the storage solution for your application, check the Google Drive SDK: https://developers.google.com/drive/

    2. Google Drive application usually rely on the users' accounts to store their files, but nothing prevents you from using your account to store all files and make them publicly accessible

    3. there's an ASP.NET MVC tutorial and sample app at https://developers.google.com/drive/examples/dotnet, however, it authenticates each user with his own account. You can start from it and replace the standard OAuth flow with one that always uses your credentials, for instance, by always using a Refresh token that you generated in advance and provided to the app.