I was wondering what could be the best way to handle google drive uploads from my web application.
In this web application the Google drive access tokens are available with the backend server.
I have two simple ways in my mind currently:
- Upload directly via frontend:
The frontend app can make an authenticated request for a drive access token to my backend. My backend can then return the access token to the frontend. Frontend can now then directly upload the file to google drive. With this approach its relatively simple, there is only single point of failure in the upload process. Also my backend doesn't have to deal with all upload related logic. On the other hand with this approach, I have to expose the drive access token to the frontend which may not be very bad.
- Proxying the upload via my backend:
With this approach my frontend will first upload the file to my backend and then my backend gonna upload the file to google drive. With this I don't have to expose the access token to client. But this has got a lot of disadvantages for e.g. in the upload process there are now multiple points of failure. My backend needs to implement all that upload logic and also needs to deal large file uploads. Thats why I am not so comfortable with this approach.
Is there any better / standard way of handling this thing ?
Any suggestion or help is appreciated. Thanks
Aucun commentaire:
Enregistrer un commentaire