更新时间:2023-12-05 09:43:52
来自 login_hint
可选.如果您的应用程序知道哪个用户正在尝试进行身份验证,它可以使用此参数向Google身份验证服务器.服务器使用提示来简化登录流程,方法是预填写登录表单中的电子邮件字段,或者通过选择适当的多登录会话.
Optional. If your application knows which user is trying to authenticate, it can use this parameter to provide a hint to the Google Authentication Server. The server uses the hint to simplify the login flow either by prefilling the email field in the sign-in form or by selecting the appropriate multi-login session.
将参数值设置为电子邮件地址或子标识符,等同于用户的Google ID.
Set the parameter value to an email address or sub identifier, which is equivalent to the user's Google ID.
要在PHP中设置此值,请调用setLoginHint函数:
To set this value in PHP, call the setLoginHint function:
$ client-> setLoginHint('user@example.com');
$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);