woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.18k stars 360 forks source link

Can't login in Woodpecker 0.12.0+ #204

Closed helmut72 closed 3 years ago

helmut72 commented 3 years ago

Can't login in Woodpecker with user/pass and Gitea when using Woodpecker after 0.11.0 release: 0.12.0, 0.13.0 and latest not working.

My configuration:

      - DRONE_GITEA=true
      - DRONE_GITEA_URL=https://gitea.domain.com
      - DRONE_ADMIN=my_gitea_user

Error message:

time="2021-05-25T20:55:06Z" level=error msg="cannot authenticate user. 403 Forbidden"

0.11.0 works without problems. Thanks!

6543 commented 3 years ago

@helmut72 whitch gitea version? di you have 2FA enabled?

helmut72 commented 3 years ago

Gitea 1.14.2, no 2FA.

6543 commented 3 years ago

Can you enable logging for gitea and tell us what calls gitea get befor it stops?

helmut72 commented 3 years ago

By default there isn't much to see. This is the output when pressing login button on Woodpecker:

2021/05/26 10:19:01 Started GET /api/v1/version for 192.168.208.1:41418
2021/05/26 10:19:01 Completed GET /api/v1/version 403 Forbidden in 387.211µs
helmut72 commented 3 years ago

I get this output in Gitea with Woodpecker 0.11.0 when pressing login button on Woodpecker:

2021/05/26 11:15:31 Started GET /api/v1/users/my_gitea_user/tokens?limit=0&page=0 for 192.168.208.1:49034
2021/05/26 11:15:31 Completed GET /api/v1/users/my_gitea_user/tokens?limit=0&page=0 200 OK in 64.176502ms
2021/05/26 11:15:31 Started DELETE /api/v1/users/my_gitea_user/tokens/21 for 192.168.208.1:49034
2021/05/26 11:15:31 Completed DELETE /api/v1/users/my_gitea_user/tokens/21 204 No Content in 73.101206ms
2021/05/26 11:15:31 Started POST /api/v1/users/my_gitea_user/tokens for 192.168.208.1:49034
2021/05/26 11:15:31 Completed POST /api/v1/users/my_gitea_user/tokens 201 Created in 134.033766ms
2021/05/26 11:15:31 Started GET /api/v1/users/my_gitea_user for 192.168.208.1:49034
2021/05/26 11:15:31 Completed GET /api/v1/users/my_gitea_user 200 OK in 63.602873ms
2021/05/26 11:15:32 Started GET /api/v1/user/repos?limit=0&page=0 for 192.168.208.1:49034
2021/05/26 11:15:32 Completed GET /api/v1/user/repos?limit=0&page=0 200 OK in 373.657952ms
helmut72 commented 3 years ago

This my Gitea log configuration:

[log]
MODE              = console
ACCESS            = console
LEVEL             = info
ENABLE_ACCESS_LOG = false
ENABLE_XORM_LOG   = false

Changing from debug and even trace doesn't show more output than info when try to login into Woodpecker. Using Gitea itself shows more log output when switch to debug or trace.

6543 commented 3 years ago

I'm sorry - I think you got hit by https://gitea.com/gitea/go-sdk/issues/517 witch I'll did not had time to fix :/

6543 commented 3 years ago

@helmut72 can you check if this gitea setting is enabled & it will work if you disable it?

helmut72 commented 3 years ago

This option doesn't change anything. One more info: it's possible to login with 0.11.0, update container to latest 0.14.0.rc and everything is still working fine. Until I logout and want to login again...

I really don't have any clue, because the changelog from 0.11.0 to 0.12.0 is very small and the login problem starts with 0.12.0

tboerger commented 3 years ago

Has woodpecker changed to OAuth2 within these versions?

6543 commented 3 years ago

no but we should

ygbillet commented 3 years ago

Same problem here.

speatzle commented 3 years ago

i found what the issue is, apparently you cannot create a gitea sdk client without any authentication set in the new sdk version (sdk was updated in the 1.12 release), ill clean up my code and make a PR.

6543 commented 3 years ago

@speatzle do you have a branch to look at?

speatzle commented 3 years ago

@6543 i just submitted PR #221

6543 commented 3 years ago

@helmut72 can you confirm it fixed your issue?

helmut72 commented 3 years ago

Will need to compile and test it. I've used your Docker image before. Can do it tomorrow. Thanks in advance!

laszlocph commented 3 years ago

laszlocloud/woodpecker-server:latest @helmut72

ygbillet commented 3 years ago

this PR fixed my issue (which could be different from @helmut72)

@laszlocph wouldn't it be woodpeckerci/woodpecker-server:latest

laszlocph commented 3 years ago

this PR fixed my issue (which could be different from @helmut72)

@laszlocph wouldn't it be woodpeckerci/woodpecker-server:latest

But of course. I mindlessly copied it from the previous release..

helmut72 commented 3 years ago

Great, works! Thank you :)