Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Google Drive be used instead of localstorage for storing/retrieving client side data?

Would Google Drive be able to be used to store data such that a client side app could read from/write to it? The data is small and would easily fit in localstorage but a requirement is that the data not be left on the machine since the computers will be in a shared environment. SO has this thread (Frameworks to store data client side) which shows many ways to store data client side but they all leave the data on the user's computer which means it would be left behind after the user is done and that's not acceptable for the use case of a public computer such as at a cybercafe or library.

The data could be stored sever side but I'd rather leave the job of user authentication and secure data storage to Google who has a lot more resources and experience on that matter than I have access to.

I've looked at the Google Drive REST API and it looks like storing won't be too bad. I've also found plenty of ways to publish data publicly from Drive. What I haven't seen is the use case of a web page accessing private data back out of Drive.

I've also found that Drive can store application data (https://developers.google.com/drive/web/appdata) but it looks like that is just for plug-in apps and not for general web apps?

Is this even possible?

like image 352
WD-40 Avatar asked Nov 21 '25 14:11

WD-40


1 Answers

Ok techinclly speaking, you can do this but there is a few limitations.

To store the data you will have to authenticate a user and user there Drive account to write to. Google drive is nice and gives you a similar %appdata% solution.

If you want to write to one central drive account say one owned by you or you company and then have everyone's applications write to that. That is the one thing you cant really do. JavaScript doesn't allow for offline or service account access. Meaning you can't set up a default drive account and give everything permission to write to that.

You have to use Oauth2 and authenticate a user and write to there drive account.

like image 166
DaImTo Avatar answered Nov 23 '25 04:11

DaImTo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!