我似乎记得 gapi.auth.authorize 有一个参数来指定一个 login_hint 来绕过帐户选择器。但我可能会谷歌,我找不到它。这只是一个梦吗?
我的问题是我遇到了帐户选择器在当前窗口下弹出的问题,因此用户错过了。
或者另一种提问方式可能是,像 login_hint 和 incremental auth 这样的参数如何 https://developers.google.com/accounts/docs/OAuth2UserAgent#incrementalAuth由 Javascript 库公开?
最佳答案
谷歌的 OAuth 2.0 documentation, under the heading Forming the URL , 表明接受了 login_hint
参数(例如,login_hint=email@fake.com
)。
JavaScript Client Library documentation, under gapi.auth.authorize
, 状态:
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.
所以你应该能够做到这一点:
gapi.auth.authorize({
// Parameters here...
'login_hint': 'email@fake.com',
// ...Parameters here
}, callbackFunc);
库将在请求 URL 中包含 login_hint
参数。
关于javascript - 如何将 login_hint 传递给 gapi.auth.authorize?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21942977/