Javascript Google OAuth2 API的哪些方法接受登录提示作为参数

Javascript Google OAuth2 API的哪些方法接受登录提示作为参数,javascript,google-oauth,google-signin,credential-manager,Javascript,Google Oauth,Google Signin,Credential Manager,我使用了,也引用了 示例应用程序(app.js)告诉我登录提示是signIn方法的有效选项: // If the user is not signed in with expected account, let sign in. return auth2.signIn({ // Set `login_hint` to specify an intended user account, // otherwise user selection dialog will popup.

我使用了,也引用了

示例应用程序(app.js)告诉我登录提示是signIn方法的有效选项:

    // If the user is not signed in with expected account, let sign in.
return auth2.signIn({
  // Set `login_hint` to specify an intended user account,
  // otherwise user selection dialog will popup.
  login_hint: id || ''
});
但是参考手册并没有说它在那里做任何事情,只对authorize()方法有效。在Web上的其他地方,我看到它与init()方法一起使用的例子

是否有人可以澄清登录提示选项在功能上处于活动状态的任何/所有位置?

来自

可选。如果您的应用程序知道哪个用户正在尝试 通过身份验证,它可以使用此参数向 谷歌认证服务器。服务器使用提示来简化操作 通过在登录表单中预先填充电子邮件字段或 通过选择适当的多重登录会话

将参数值设置为电子邮件地址或子标识符 相当于用户的Google ID

要在PHP中设置此值,请调用setLoginHint函数:

$client->setLoginHint('user@example.com');

您的代码:

options = new gapi.auth2.SigninOptionsBuilder();
options.setAppPackageName('com.example.app');
options.setFetchBasicProfile(True);
//options.setPrompt('select_account');
options.setLoginHint('user@example.com');
options.setScope('profile').setScope('email');

auth2.signIn(options);

auth2.signIn()
login\u hint
选项是文档发布后新增的。让我与文档团队一起更新它。谢谢!init()也可以使用它吗@我对此表示怀疑。你能自己试试吗?对不起,我没有直接的环境来尝试。不用担心。我不需要。刚刚在网上看到其他人在尝试。