Skip to content

Add login hint support for GitHub browser-based OAuth authentication#1137

Merged
mjcheetham merged 4 commits into
git-ecosystem:mainfrom
mjcheetham:login-hint
Mar 3, 2023
Merged

Add login hint support for GitHub browser-based OAuth authentication#1137
mjcheetham merged 4 commits into
git-ecosystem:mainfrom
mjcheetham:login-hint

Conversation

@mjcheetham

@mjcheetham mjcheetham commented Mar 1, 2023

Copy link
Copy Markdown
Contributor

If a username is specified in the remote URL then include this as a login hint when performing OAuth authentication for GitHub. This can help users of multiple accounts select the correct account before the OAuth flow completes and returns a token for the wrong account.

GitHub shows this nice prompt when a login hint is provided that does not match the currently logged-in user:

image

At the same time, if there is no logged-in user, then the login page's username box is already filled in:

image

The login hint is specified to GitHub via the extra login query parameter to the authorization endpoint.

Add the ability to include extra query parameters in the authorization
code grant request. This allows consumers of the OAuth2Client to
customise the login experience that may include vendor specific args.
If a username is specified in the remote URL then include this as a
login hint when performing OAuth authentication for GitHub.
@mjcheetham mjcheetham added enhancement New feature or request host:github Specific to the GitHub host provider auth:oauth Specific to OAuth2 authentication labels Mar 1, 2023
@mjcheetham
mjcheetham requested a review from ldennington March 1, 2023 18:28
Add a unit test to ensure that we do not allow overriding or replacing
standard OAuth2 query parameters.

@ldennington ldennington left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@mjcheetham
mjcheetham merged commit 3979577 into git-ecosystem:main Mar 3, 2023
@mjcheetham
mjcheetham deleted the login-hint branch March 3, 2023 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth:oauth Specific to OAuth2 authentication enhancement New feature or request host:github Specific to the GitHub host provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants