Google Drive help required access to own Drive account

那年仲夏 提交于 2019-12-31 07:34:08

问题


I want to access my own google drive on web page but allow anyone to upload files and restrict download access or show only limited file to user for downloading.

Drive API assumes that I will access another users credentials. But what I want is opposite, anyone can view my files (restricted what to view) but is free to upload. I have google nearly 6+ hours and didn't found any solution

Any Help Appreciated Thanks


回答1:


You say "Drive API assumes that I will access another users credentials" but this isn't correct. Calls to Drive include an Access Token, and it is that which determines which Drive account the call will access. Drive makes no assumptions about how that Access Token was obtained or which account it refers to.

All of the examples show how an Access Token is obtained for an end user, since that is the more complex flow. Your requirement is very much simpler.

All you need to do is:-

  1. Obtain a refresh token (see How do I authorise an app (web or installed) without user intervention? (canonical ?))
  2. Store that refresh token in your PHP application. Make sure it's secure
  3. When you need to access your Drive account, use the refresh token to obtain an access token as described at https://developers.google.com/accounts/docs/OAuth2WebServer#refresh


来源:https://stackoverflow.com/questions/28784575/google-drive-help-required-access-to-own-drive-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!