File upload to Google Drive
This article show how to configure ASPRunner.NET to upload files to Google Drive cloud storage.
Configuration
When you set 'Edit as' type of the field to File/Image you now have an option to choose one of the cloud storage options.This article explains how to configure files upload to Google Drive.
Create API credentials in Google Cloud Console
Proceed to Google Cloud console. Under APIs & Services -> Credentials click '+ Create Credentials'. Choose 'OAuth client ID' option. On the next screen choose 'Web application' as Application Type.
Once OAuth client is created copy ClientID and Client Secret
In Oauth Client properties add Authorized redirect URIs. For local testing use:
http://localhost:8086/oauthcallback
For production use:
https://server.com/path/oauthcallback
2. Enable Google Drive API
Under 'Library' find 'Google Drive API', click it and then click 'Enable'.
Folder ID
Folder ID is optional. If you do not specify it, files will be uploaded to the root folder.
To find the folder id proceed to that folder in Google Drive in your web browser. The URL may look like this:
https://drive.google.com/drive/u/3/folders/0B-9X707clcqJMmI4OTI4MWEtMDBmNS00OGIwLThiZmYtOWJhMDdiNTc3ZmU3?resourcekey=0-z0sQH4Jjn_-nLn64zuPDvg
Here 0B-9X707clcqJMmI4OTI4MWEtMDBmNS00OGIwLThiZmYtOWJhMDdiNTc3ZmU3 is your folder id.
Important note
After the project is built and published, open it in the web browser and proceed to any page of a table where cloud storage is used. You will be redirected to Google's site to log in.Log in under the account that should be used to store the files. Then the application will save the credentials, and no further login will be needed.
The credentials are saved in \templates_c\googledrive.json file. If you need to change the GoogleDrive configuration and start storing files under a different account, delete that file, then close all browser windows to clear the session. Open any page where cloud storage is used in the browser again and log in to Google using your new account.