Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support any OAuth server with custom config #1047

Closed
hickford opened this issue Jan 22, 2023 · 6 comments · Fixed by #1062
Closed

Support any OAuth server with custom config #1047

hickford opened this issue Jan 22, 2023 · 6 comments · Fixed by #1062
Assignees
Labels
auth:oauth Specific to OAuth2 authentication host:generic Specific to the generic (basic/WIA) host provider

Comments

@hickford
Copy link
Contributor

hickford commented Jan 22, 2023

To add OAuth support for a new forge requires around a thousand lines of code which has to be reviewed (example PRs: GitLab, Gitea, Gitee). Each new assembly adds megabytes to git-credential-manager binary size. Is any code necessary? All are similar OAuth implementations with only trivial differences in OAuth parameters.

Ideally you could use GCM with any generic OAuth forge with only simple config to specify the OAuth parameters, no code change necessary.

https://github.com/hickford/git-credential-oauth has this feature. Here's an example config for gitee.com:

[credential "https://gitee.com"]
	oauthClientId = b5da229f85d94f5d728c43e429c69527fe2dcc387d4ffcb677b91c93983adaa3
	oauthClientSecret = a9f88c722f66e54184204efa0f49b960f2666947e0b14bd0d73a8c9c1c33c340
	oauthScopes = projects gists
	oauthAuthURL = /oauth/authorize
	oauthTokenURL = /oauth/token
	# workaround server confused by random ports
	oauthRedirectURL = http://127.0.0.1:53119
@hickford hickford changed the title Support for generic OAuth forges through simple config without writing any code Support any OAuth server with custom config Jan 22, 2023
@maikebing
Copy link

Great job!

@ldennington
Copy link
Contributor

Thanks @hickford! This is something we've been talking about internally for awhile given the number of different Git hosts/forges that want GCM support via OAuth. In light of this, we've decided generic OAuth provider support would make sense here. We plan to have this complete in time for Git 2.40 release.

This was referenced Jan 24, 2023
@mjcheetham mjcheetham self-assigned this Feb 1, 2023
@mjcheetham mjcheetham added auth:oauth Specific to OAuth2 authentication host:generic Specific to the generic (basic/WIA) host provider labels Feb 1, 2023
@mjcheetham
Copy link
Collaborator

Now that #1062 has been merged this means the next GCM release will include support for generic OAuth providers!

@maikebing
Copy link

Maybe the LOGO path configuration is missing? @mjcheetham

@mjcheetham
Copy link
Collaborator

Maybe the LOGO path configuration is missing? @mjcheetham

Are you looking for a way to add custom branding/logos to the generic OAuth UI prompts?

image

At the moment we don't plan to add support for customising the UI with branding. If you wanted to submit a PR adding the functionality we would consider it! Configuration pointing at either a local or remote file (URL) may be one acceptable method for this, but we'd want to be sure pulling external content from the Internet to be rendered was safe.

@ldennington
Copy link
Contributor

Closing as this feature was released in 2.0.935 🎉 .

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 host:generic Specific to the generic (basic/WIA) host provider
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@hickford @maikebing @mjcheetham @ldennington and others