Upload a file in a defined Google Drive (e.g. always to my GoogleDrive)

19 views
Skip to first unread message

Thomas Mühlbauer

unread,
Feb 13, 2015, 4:17:19 AM2/13/15
to google-drive...@googlegroups.com
Hi,

is it possible, to upload a file (via google api php) to a fix defined google drive storage without AuthO2?

Example:

A user clicks on a button of my webseite, and then a file gets created in my google drive konto. Is this possible?


best regards,

Thomas Mühlbauer

Chris Holcomb

unread,
Jan 26, 2016, 12:59:16 PM1/26/16
to Google Drive API and SDK
If your goal is to not have the user get the OAuth2 login, then you can have your system generate the OAuth2 the first time to your drive account so when they upload files it is using your account and doesn't need theirs. Then just store the data about the files in your database so when they are browsing they aren't even using the google api only your database as normal.

I am doing something like this now with the exception that the admin for the client links their companies google account and I store their auth token including the refresh token in my database and use it to upload and retrieve files. No one else ever gets an option to login. When you use the Google Picker to upload files you will need to get the auth token from your database and use that token in the Picker, the Picker will return an array of the files uploaded, you take that array and pass it back to your server to have your server loop through the ID's, do a $drive_service->$file->get($id), take the data from the response and put it in your database.

Alberto Valenty

unread,
Sep 27, 2018, 10:19:20 AM9/27/18
to Google Drive API and SDK
You will need the user auth at least once, and then store the access token array returned,,, Chirs Holcomb explained it well
Reply all
Reply to author
Forward
0 new messages