Google Drive help required access to own Drive account

前端 未结 1 927
执笔经年
执笔经年 2021-01-29 06:21

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 A

1条回答
  •  抹茶落季
    2021-01-29 06:23

    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

    0 讨论(0)
提交回复
热议问题