强制使用Google帐户选择器 [英] Force google account chooser
问题描述
有没有一种方法可以强制 google帐户选择器出现,即使用户仅使用一个帐户登录也可以.
Is there is a way I can force the google account chooser to appear even if the user is logged in just with one account.
我已尝试通过重定向到此URL:
I have tried by redirecting to this URL:
https://accounts.google.com/AccountChooser?service=lso&continue=[authorizeurl]
它似乎可以工作,但是我不知道它是否还有其他条件可能会失败.
and it seems to work, but I don't know if there are any other conditions in which it might fail.
推荐答案
OAuth2授权URL支持以下参数:
The following parameter is supported in OAuth2 authorization URLs:
prompt
当前它可以具有值none
,select_account
和consent
.
Currently it can have values none
, select_account
, and consent
.
-
无:将导致Google不显示任何用户界面,因此,如果用户需要登录,则失败,如果多次登录,则选择一个帐户,如果首次批准,则同意.它可以在不可见的i框架中运行,以便在决定(例如)渲染授权按钮之前从先前授权的用户那里获取令牌.
none: Will cause Google to not show any UI, and therefore fail if user needs to login, or select an account in case of multi-login, or consent if first approval. It can be run in an invisible i-frame to obtain a token from previously authorized users before you decide, for instance, to render an authorization button.
同意:即使用户先前已授权您的应用程序,也将强制显示批准页面.在某些特殊情况下可能会很有用,例如,如果您丢失了用户的refresh_token,因为Google仅在明确表示同意的情况下才会发出refresh_token.
consent: Will force the approval page to be displayed even if the user has previously authorized your application. May be useful in a few corner cases, for instance if you lost the refresh_token for the user, as Google only issues refresh_tokens on explicit consent action.
select_account:即使您只有一个登录用户,也将按照您的要求显示帐户选择器.
select_account: Will cause the account selector to display, even if there's a single logged-in user, just as you asked.
select_account
可以与consent
组合,如下所示:
select_account
can be combined with consent
, as in:
prompt=select_account consent
这篇关于强制使用Google帐户选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!