使用login_hint预先填充Google oAuth2的电子邮件框 [英] Use login_hint to pre-fill email box for Google oAuth2

查看:193
本文介绍了使用login_hint预先填充Google oAuth2的电子邮件框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取访问代码以使用Google api(oAuth2)时,一个参数称为login_hint,其定义为;

When getting the access code to use Google api's (oAuth2), one parameter is called login_hint and its defined as;

"当您的应用程序知道它要尝试验证的用户时,它可以将此参数作为提示提供给Authentication Server.传递此提示将预填写登录表单上的电子邮件框或选择适当的多登录会话,从而简化了登录流程."

"When your application knows which user it is trying to authenticate, it may provide this parameter as a hint to the Authentication Server. Passing this hint will either pre-fill the email box on the sign-in form or select the proper multi-login session, thereby simplifying the login flow."

我发现它没有填写电子邮件框,不知道为什么.网址的格式如下;

I'm finding it is NOT filling in the email box and wondering why. The url is formed as follows;

var url:String = 'https://accounts.google.com/o/oauth2/auth?' +
    'scope=https://mail.google.com/&' +
    'redirect_uri=<my_redirect_uri>&' +
    'response_type=code&' +
    'login_hint=abc@gmail.com&' +
    'client_id=<my_client_id>;

该网址可以很好地获取登录页面,但电子邮件字段未预先填写.谁能告诉我如何进行这项工作?

The url works fine to get the login page but the email field is not pre-filled. Can any one tell me how to make this work?

推荐答案

很奇怪,我尝试通过客户端访问您的网址,并且该网址有效.您可以验证https://accounts.google.com/o/oauth2/auth?redirect_uri=https://developers.google.com/oauthplayground&response_type=code&client_id=407408718192.apps.googleusercontent.com&scope=https://mail.google.com/&login_hint=abc@gmail.com为您工作吗?用现有电子邮件替换abc@gmail.com.

Weird, I tried your url with a client and it worked. Could you verify that https://accounts.google.com/o/oauth2/auth?redirect_uri=https://developers.google.com/oauthplayground&response_type=code&client_id=407408718192.apps.googleusercontent.com&scope=https://mail.google.com/&login_hint=abc@gmail.com works for you? Replace abc@gmail.com with an existing email.

这篇关于使用login_hint预先填充Google oAuth2的电子邮件框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆