Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use login_hint to pre-fill email box for Google oAuth2

Tags:

google-oauth

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

"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&' +
    '[email protected]&' +
    '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?

like image 773
harkdh Avatar asked May 16 '13 00:05

harkdh


1 Answers

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/&[email protected] works for you? Replace [email protected] with an existing email.

like image 77
Chao Wei Avatar answered Sep 24 '22 14:09

Chao Wei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!