Skip to content

Google sign-in skips account chooser after sign-out (missing prompt=select_account) #1053

Description

@thisisjoshford

Problem

After signing out of NEAR AI Cloud and signing back in with Google, users are not shown the Google account chooser. Google silently re-selects the previously used account, so there is no way to switch to a different Google account without signing out of Google itself.

The chooser only appears on the very first sign-in (before the user has granted consent to the app).

Cause

The Google authorization URL built in crates/services/src/auth/oauth.rs (google_auth_url) does not set a prompt parameter. The redirect currently issued by GET /v1/auth/google contains only:

response_type, client_id, state, code_challenge, code_challenge_method, redirect_uri, scope=email openid profile

Without prompt, Google skips the account chooser whenever the user has an active Google session and has already consented.

The frontend cannot work around this: /v1/auth/google only accepts frontend_callback (OAuthInitQuery) and does not forward other query parameters to Google.

Proposed fix

Add prompt=select_account to the Google authorization URL:

.set_pkce_challenge(pkce_challenge)
.add_extra_param("prompt", "select_account")
.url();

select_account shows the chooser on every sign-in without forcing the consent screen again. nearai/agents-market-v2 already does this in crates/services/src/oauth/google.rs.

GitHub has the same behavior, and GitHub's authorize endpoint also supports prompt=select_account, so github_auth_url could get the same change.

Steps to reproduce

  1. Sign in to NEAR AI Cloud with Google (account chooser appears).
  2. Sign out.
  3. Click "Sign in with Google" again.
  4. Expected: Google account chooser appears. Actual: Google auto-selects the previous account and signs in immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions