编程语言
首页 > 编程语言> > javascript – 使用Google Picker而无需使用Google帐户登录(使用OAuth)

javascript – 使用Google Picker而无需使用Google帐户登录(使用OAuth)

作者:互联网

是否可以向未使用Google帐户登录的用户提供Google Picker?我想让用户从我网站的Google帐户的共享Google云端硬盘中选择文件.我可以在服务器上使用OAuth访问这些文件.但是也可以使用Google Picker呈现文件吗?也许用这种方法:

PickerBuilder.setOAuthToken(string)

Sets an OAuth token to use for authenticating the current user.
Depending on the scope of the token, only certain views will display
data. Valid scopes are Google Docs, Drive, and Photos. This method
should be used instead of .setAuthUser when a user is authenticated
with OAuth.

Google Picker API reference

我试过这个,我认为这是不可能的.或者是吗?

解决方法:

API的这种方法确实有效(我目前使用它).请注意,谷歌的身份验证令牌过期,您可能需要刷新您的令牌,否则谷歌选择器将在尝试从谷歌驱动器检索文件列表时返回401.

PickerBuilder.setOAuthToken(string)

标签:javascript,oauth,oauth-2-0,google-oauth,google-picker
来源: https://codeday.me/bug/20190709/1412661.html