Another solution would be to always prompt a user to select a Google account, even if they’re only logged into one.
Both that, or:
are possible with a handful of lines of code.
Discourse uses the omniauth-google-oauth2 gem for authentication, and as per its documentation:
- the first can be done by setting the
promptsetting toselect_account - the second can be done by setting the
hdsetting to the G Suite domain
You pass in these options here, like the skip_jwt parameter:
I imagine the core team will graciously accept a PR doing one or the other if you put them behind a site setting. If you want this right now, or are not tracking tests-passed with your instance, then you could implement this in an plugin which registers an auth provider which inherits Auth::GoogleOAuth2Authenticator and redefines the register_middleware method (or I guess you could even monkey patch that method in your plugin before it’s called instead).
Hope this helps ![]()