Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass login_hint to gapi.auth.authorize?

I seem to recall there was a parameter to gapi.auth.authorize to specify a login_hint to bypass the account picker. But Google as I might, I can't find it. Was it just a dream?

My problem is that I'm having issues where the account picker is popping under the current window, so is being missed by the user.

Or another way of asking the question might be, how are arguments like login_hint and incremental auth https://developers.google.com/accounts/docs/OAuth2UserAgent#incrementalAuth exposed by the Javascript library?

like image 400
pinoyyid Avatar asked Jan 17 '26 23:01

pinoyyid


1 Answers

Google's OAuth 2.0 documentation, under the heading Forming the URL, states that a login_hint parameter is accepted (for example, [email protected]).

The JavaScript Client Library documentation, under gapi.auth.authorize, states:

If the key is not one of the expected OAuth 2.0 parameters (see below), it is added to the URI as a query parameter.

So you should be able to do this:

gapi.auth.authorize({
    // Parameters here...
    'login_hint': '[email protected]',
    // ...Parameters here
}, callbackFunc);

The library will include the login_hint parameter in the request URL.

like image 123
Tyler Eich Avatar answered Jan 20 '26 13:01

Tyler Eich