Documentation for Google Drive's inline file viewer API

I’m struggling to find info on Google Drive’s file viewer API. I want to show files from a public site on my webpage using an iframe. The URL I’m using is like this:

https://drive.google.com/viewerng/viewer?url=FILE_URL&embedded=true

It works for public files, but I’m having trouble with files that need login info. I’ve looked everywhere but can’t find any good docs for this API. Does anyone know where I can find details about how to use it, especially for files that need authentication? I’m really stuck and could use some help!

yo, i feel ur pain. google’s file viewer is a real pain. for private files, try the official drive api or a server-side proxy for login. it sucks, but it may be the only work-around.

I’ve encountered similar issues with Google Drive’s viewer API. Unfortunately, there’s no comprehensive documentation available for this unofficial method. The embedded viewer is primarily designed for public files, making it challenging to use with authenticated content.

For files requiring login, you might want to explore Google Drive’s official API. It offers more robust authentication options and better control over file access. While it requires more setup, including creating a Google Cloud project and implementing OAuth 2.0, it’s a more reliable solution for handling private files.

Alternatively, you could consider implementing a server-side solution that manages authentication and serves the file content to your front-end. This approach bypasses the limitations of the embedded viewer and gives you more flexibility in handling various file types and access levels.

If you’re set on using the viewer API, you might need to experiment with different authentication methods or look into third-party libraries that have implemented workarounds for this specific use case.

I’ve been down this road before, and it can be frustrating. Google doesn’t provide much official documentation for their viewer API, which is why you’re hitting a wall. From my experience, the embedded viewer works great for public files, but it’s not designed to handle authenticated access.

For files requiring login, you might need to look into alternative solutions. One approach I’ve used is to set up a server-side proxy that handles the authentication and then serves the file content to your front-end. This way, your webpage doesn’t need to deal with Google’s authentication directly.

Another option is to use Google Drive’s official API instead. It’s more complex to set up, but it gives you much more control over file access and display. You’ll need to create a Google Cloud project and use OAuth 2.0 for authentication, but it’s well-documented and more reliable for handling private files.

Hope this helps point you in the right direction. Good luck with your project!