git-ecosystem / git-credential-manager

Secure, cross-platform Git credential storage with authentication to GitHub, Azure Repos, and other popular Git hosting services.
Other
6.74k stars 1.76k forks source link

How to add PKCE to .gitconfig for OAuth2 #1303

Closed em2943 closed 1 year ago

em2943 commented 1 year ago

Version

2.1.2

Operating system

Linux

OS version or distribution

6.3.9-arch1-1

Git hosting provider(s)

Other - please describe below

Other hosting provider

gitea

(Azure DevOps only) What format is your remote URL?

None

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

to open a tab in browser to authenticate gitea then push my commit

Actual behavior

open browser tab, fails to authenticate, fails to push commit.

Logs

mjcheetham commented 1 year ago

PKCE is always included in OAuth requests made by Git Credential Manager:

https://github.com/git-ecosystem/git-credential-manager/blob/4e8674aeb62317641a5a53834563d48441cf4d95/src/shared/Core/Authentication/OAuth/OAuth2Client.cs#L108-L109

I do not understand what you are asking for. Is Gitea returning errors relating to PKCE?

open browser tab, fails to authenticate, fails to push commit.

Please can you enable trace logging and share the output please?

GCM_TRACE=1 git ls-remote https://gitea.com/<your-repo>

When I try using your configuration, I get an error indicating the redirect URI has not been registered correctly with your Gitea application.

image
em2943 commented 1 year ago

I just got it to work :) here is the log git.log