Access public text file from Google Drive without Auth (JavaScript)

Viewed 149

So I've been looking for a way to do this for a while, and haven't found such a great way to do so:

I have many large files stored in a google drive, and I plan to grab data based on a parameter passed. I already wrote the (very simple) code to get the right file, but I'm unable to figure out how to open the text file without having to use google auth. The files are public for anyone to view with the link. I should note that downloading them and reading them wouldn't really work as some files are many GB big and it would be very slow to download, then search for my string, and then delete the file repeat.

If anyone could help me figure out how to do this for my website please let me know; if you cannot do it without auth then I guess I'll have to use the drive JS api yeah?

1 Answers

If you consult the Google Drive API documentaiton about authenticaton, you will see the following:

enter image description here

So, unfortunately you cannot access the file OAuth with the Google Drive API.

Alternatively, you can try XMLHttpRequest or other fetching / web scraping techniques.

But honestly, using OAUth in Javascript is well documented - all you need is to insert a client ID and API key tot rigger authentication flow.

Related