使用 Google 云端硬盘网络客户端时选择帐户 API
Choose account when using Google Drive web client API
当您使用 Google 云端硬盘网络客户端时,您可以在第一次选择要连接的 Google 帐户。完成后,后续调用将跳过您可以选择帐户的步骤 - 您无需再次授权。有什么方法可以在不实际退出您的 Google 帐户的情况下再次触发帐户选择?
我正在使用文件选择器 API,请参阅 https://developers.google.com/picker/docs/
阅读问题后Is it possible to be able to correctly select any available Google account to use when using authorisation via the JS client library for Drive?我发现下面的授权调用实现了我想要的:
function onAuthApiLoad() {
window.gapi.auth.authorize({
'client_id': clientId,
'scope': scope,
prompt: 'select_account',
authuser: -1
},
handleAuthResult);
}
authuser 参数指定应自动选择多个帐户中的哪个,默认为 0。添加时
prompt: 'select_account',
authuser: -1
none 个帐户被自动选择,因此再次提示用户。
当您使用 Google 云端硬盘网络客户端时,您可以在第一次选择要连接的 Google 帐户。完成后,后续调用将跳过您可以选择帐户的步骤 - 您无需再次授权。有什么方法可以在不实际退出您的 Google 帐户的情况下再次触发帐户选择?
我正在使用文件选择器 API,请参阅 https://developers.google.com/picker/docs/
阅读问题后Is it possible to be able to correctly select any available Google account to use when using authorisation via the JS client library for Drive?我发现下面的授权调用实现了我想要的:
function onAuthApiLoad() {
window.gapi.auth.authorize({
'client_id': clientId,
'scope': scope,
prompt: 'select_account',
authuser: -1
},
handleAuthResult);
}
authuser 参数指定应自动选择多个帐户中的哪个,默认为 0。添加时
prompt: 'select_account',
authuser: -1
none 个帐户被自动选择,因此再次提示用户。