Skip to content

[Auth] Allow user select GitHub account on login#3801

Merged
huchenlei merged 1 commit intomainfrom
github-acc-select
May 7, 2025
Merged

[Auth] Allow user select GitHub account on login#3801
huchenlei merged 1 commit intomainfrom
github-acc-select

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented May 7, 2025

Continuation of #3777. Allow using multiple GitHub accounts per client.

OAuth parameters: https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml

┆Issue is synchronized with this Notion page by Unito

@christian-byrne christian-byrne requested review from a team as code owners May 7, 2025 13:45
Copy link
Contributor

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify this does allow multiple github account to be selectable?

Based on my previous chat with LLM, it seems like github provider does not need special configuration.

Let me check the Firebase documentation and the current implementation to answer your question.

Looking at the code, I can see that the Google provider is set up with a custom parameter to prompt account selection:

  const googleProvider = new GoogleAuthProvider()
  googleProvider.setCustomParameters({
    prompt: 'select_account'
  })

For GitHub authentication, the select_account parameter is not applicable. This is because GitHub's OAuth implementation works differently from Google's. GitHub's authentication flow already handles account selection differently:

  1. If you're not logged into GitHub, it will show the login page
  2. If you're logged into GitHub, it will directly use that account
  3. If you want to use a different GitHub account, you need to log out of GitHub first

So there's no need (and no way) to set a select_account parameter for the GitHub provider. The current implementation is correct as is:

  const githubProvider = new GithubAuthProvider()

This is the standard way to implement GitHub authentication with Firebase, and it follows GitHub's OAuth best practices.

@christian-byrne
Copy link
Contributor Author

christian-byrne commented May 7, 2025

Of course I verified it works. I would not submit a PR for code that I did not test.

Selection_1341

@huchenlei huchenlei merged commit 1ef3c00 into main May 7, 2025
10 checks passed
@huchenlei huchenlei deleted the github-acc-select branch May 7, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants