git-credential-oauth icon indicating copy to clipboard operation
git-credential-oauth copied to clipboard

how to make it work with authelia?

Open flixman opened this issue 7 months ago • 0 comments

I am running gitea behind authelia. I have configured git-credential-oauth like

[credential "https://gitea.test.local"]
        oauthClientId = gitea-credential-oauth
        oauthScopes = read_repository write_repository
        oauthAuthURL = /oauth/authorize
        oauthTokenURL = /oauth/token
        oauthDeviceAuthURL = /oauth/authorize_device

the client in authelia is public. I then try to verify that authentication works, which takes me to the gitea portal and then I get a 404 (Not Found) error.

$ printf "host=gitea.test.local\nprotocol=https\n" | git-credential-oauth -verbose get
git-credential-oauth 0.15.1
input: map[host:gitea.test.local protocol:https]
Please complete authentication in your browser...
https://gitea.test.local/oauth/authorize?client_id=gitea-credential-oauth&code_challenge=mzJ9IRgFIi86rAW82F2CfyNjoMA3LXg3QUD8YaCjx_4&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A33911&response_type=code&scope=read_repository+write_repository&state=VRsMIZcdmPmsxI2sUUlmDbedGTSq6TVKGy-aXsV1NWg

If I try to use git push, directly, this is the error I get:

Pushing to https://gitea.test.local/appuser/test.git
fatal: unable to update url base from redirection:
  asked for: https://gitea.test.local/appuser/test.git/info/refs?service=git-receive-pack
   redirect: https://auth.test.local/?rd=https%3A%2F%2Fgitea.test.local%2Fappuser%2Ftest.git%2Finfo%2Frefs%3Fservice%3Dgit-receive-pack&rm=GET

which makes sense, because authelia sits in front of gitea, and upon successful authentication will forward the following requests to it.

What is wrong in my setup?

flixman avatar May 08 '25 05:05 flixman