简体   繁体   中英

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?

Google's OAuth 2.0 documentation, under the heading Forming the URL , states that a login_hint parameter is accepted (for example, login_hint=email@fake.com ).

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@fake.com',
    // ...Parameters here
}, callbackFunc);

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM