Search code examples
node.jsgoogle-drive-realtime-api

Can I use server side generated token to upload files to google drive in client side(angularjs)


I am new to google drive API. I want to use google drive to save my web site files. file should be save to one google drive(my google drive). Any one can login to my web site and upload files. To use google drive there is a authentication process and token generation. That generated token need to use with API.

My problem is how can I do that without using user's google account(user don't want to login). Even they don't know they are uploading images to my google drive. I am using Node and AngularJs.

I have an idea to generate token in node server using my google account credentials and pass to client side. Is it possible?

please help me!!


Solution

  • Yes, you can use get a token for your Drive using a service account, and then pass that to the client. However anyone that can read the token can use it to access your Drive, so don't share it publicly. https://developers.google.com/identity/protocols/OAuth2ServiceAccount