rtCamp / login-with-google

Minimal plugin which allows WordPress user to login with google.
https://wordpress.org/plugins/login-with-google/
GNU General Public License v2.0
62 stars 19 forks source link

Cannot login to second Google account if current account not from whitelisted domain #92

Closed benjaminmead closed 3 years ago

benjaminmead commented 3 years ago

Hi,

If the user is (i) currently signed in to their personal Gmail account (ii) is not signed in to their Google Workspace account from a whitelisted domain

When they go to login, there is no option for them to choose to login to their Google Workspace account.

I believe this can be solved by adding a parameter to the OAuth2 Authorisation URL: ?prompt=select_account

This could potentially be a new option?

Thank you + grateful for your plugin!

Ben

ankitrox commented 3 years ago

@benjaminmead You can use rtcamp.google_client_args filter to add prompt => 'select_account' parameter in GoogleClient object.

Following code can be added in functions.php file of active theme.

function lwg_prompt_arg( $client_args ) {
    $client_args['prompt'] = 'select_account';

    return $client_args;
}
add_filter( 'rtcamp.google_client_args', 'lwg_prompt_arg' );

Let me know if this helps.

benjaminmead commented 3 years ago

Worked like a charm without '>' in the second line :)

Thanks!