Skip to content

Support any OAuth server with custom config #1047

@hickford

Description

@hickford
Contributor

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

Activity

changed the title [-]Support for generic OAuth forges through simple config without writing any code[/-] [+]Support any OAuth server with custom config[/+] on Jan 22, 2023
maikebing

maikebing commented on Jan 23, 2023

@maikebing

Great job!

ldennington

ldennington commented on Jan 24, 2023

@ldennington
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.

self-assigned this
on Feb 1, 2023
added
auth:oauthSpecific to OAuth2 authentication
host:genericSpecific to the generic (basic/WIA) host provider
on Feb 1, 2023
mjcheetham

mjcheetham commented on Feb 1, 2023

@mjcheetham
Collaborator

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

maikebing

maikebing commented on Feb 3, 2023

@maikebing

Maybe the LOGO path configuration is missing? @mjcheetham

mjcheetham

mjcheetham commented on Feb 7, 2023

@mjcheetham
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

ldennington commented on Mar 7, 2023

@ldennington
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

Metadata

Metadata

Assignees

Labels

auth:oauthSpecific to OAuth2 authenticationhost:genericSpecific to the generic (basic/WIA) host provider

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @hickford@maikebing@mjcheetham@ldennington

    Issue actions

      Support any OAuth server with custom config · Issue #1047 · git-ecosystem/git-credential-manager