Google drive as file storage
Ok, so I know that this is going to sound really stupid, but I have my reasons. I need to do all the CRUDs on a predefined google docs folder and I am having some issues with finding out how.
TLDR on the app is you log inn through Kinde and you will be able to make a report, look at the folders and files in the doc and do the CRUD.
I have looked at some guides, but all that I have found require you to sign inn with your google account and gives the client access to there drive, I don't want the users to sign inn with google and I want them to only access the files in the folder I have predefined
Im using Next.js for everything
If anyone has a link to a guide/video/repo it would have been a lot of help! TY
7 Replies
When you say access in a folder you predefined- is it in your google drive or theirs?
Thing about working with Google Drive is you kind of need to have that sign in if you want the folders to not be publically accessible. Unless of course you're exclusively using your own Drive folder, like the other commenter said?
(Sorry, I literally have no idea what your nickname says)
I am exclusivly going to use the drive owned by [email protected] (prob going to find a better google user name)
Disclaimer that I haven't done much with the google drive APIs so I might be ignorant of some hack to make the auth do what you want.
That said, my guess is that google probably doesn't support quite what you want. So instead of having the client on the kindle directly connect to google drive (requiring that it log into google, by the sound of it), my suggestion would be to have your server present its own CRUD endpoints, and then the server can use a client secret (or whatever OAuth flow makes sense) to interact with google docs on the backend. Basically like how a normal database would work: you don't give the client direct access to your postgres db, instead you give your server access using a secret and then your server acts as a middle man between the DB (in this case google docs) and the client. Then you're completely free to do the authentication (or lack thereof) between the client and your server however you want.
Might this be what you want? https://developers.google.com/drive/api/guides/about-sdk
Google for Developers
Google Drive API overview | Google for Developers
Explore the features of the API that you can use to integrate apps with moonrise-replaced585ad39400b4bb19c695e4f56685ab2moonrise-replace cloud storage and the moonrise-replace34fc60c62a754bb981bc3a081e7a503amoonrise-replace UI.
I would recommend against using google drive for file storage. They have made it just an absolute boat load of shit that you have to haul your ass through to get file storage working properly.
The methods they provide require adding enough complexity to not make it worth it until you absolutely need to.
That being said, I've found service accounts to provide the lowest barrier to entry to most google services. You create a folder on your google drive, add your service account as an owner or something and you can do what you want to do.
The google drive api is, afaik, meant only for when you need to access a client's drive.
go to your google cloud admin panel, create a service account, grant it the proper api permissions and add it to the folder.
Implementing it in code is fairly simple too.