-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Drone auth not working with internal users #6883
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
Comments
Can confirm having the same problem with gitea version |
Same case for me. I tried to downgrade gitea to image 6b4465a87455 but it failed. I'm using gitea/gitea:latest 1.9.0+dev-223-g6db3dc7c0 with sqlite |
Let me add some additional information here. Looks like I have the same issue with the following setup: Docker compose: version: "3"
services:
nginx:
image: nginx:latest
ports:
- 80:80
- 443:443
volumes:
- ./data/nginx/config:/etc/nginx/conf.d
gitea:
image: gitea/gitea:latest
restart: always
volumes:
- ./data/gitea:/data/gitea
ports:
- 3000:3000
- 22:22
drone:
image: drone/drone:latest
environment:
- DRONE_GITEA_SERVER=https://git.<server>
- DRONE_RUNNER_CAPACITY=2
- DRONE_SERVER_HOST=drone.<server>
- DRONE_SERVER_PROTO=https
- DRONE_GIT_ALWAYS_AUTH=false
- DRONE_RPC_SECRET=<secret>
ports:
- 81:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data/drone:/data nginx configuration:
After loggin in on drone. i get the message "Login Failed. Unauthorized". docker compose log:
|
I think I'm encountering the same issue - looking at the HTTP requests from Drone to Gitea I can see the token creation working fine (with Authorization: basic):
But then the subsequent user profile request fails, because the 'Authorization: token' header is missing the actual token:
The token is clearly being returned back to Drone in the token creation step, but Drone is not then using it correctly for the subsequent call. Perhaps the token-create response format has changed and is confusing Drone? Update: it looks like the token-create response has indeed changed, with 'sha1' changing to 'token': |
This problem was apparently fixed by 1dc4016 (I can confirm that it is fixed in 1.9.0+dev-231-g34eee25bd - Drone is authenticating without the error). |
I still have the same problem right on that version. |
Fixed in #6903 |
It worked earlier for me but I have just had a recurrence. I had to go into Gitea -> Settings -> Applications and delete the 'drone' token, after which Drone could then reconnect (recreating the token). Update: And it just happened again after logging out of Drone - deleting the token then fixed it, so something is not right somewhere. The token-create API call does return a different sha1 each time, suggesting that it is recreating the token as it should be. |
That’s likely because the token is now hashed for security reason. Drone tried to fetch it again which doesn’t work because it cant, as we are using a one way hash function. However OAuth2 is the recommended way of using Drone. |
Indeed, I just tried Gitea 1.8.0 again and the call to /tokens does return the token itself which Drone expects, not so with the newer versions. So presumably either the Drone documentation needs updating to remove the non-OAuth2 method as it is now broken, or Drone needs changing to regenerate the token each time (via Basic auth) as it can no longer retrieve the previous one? |
On gitea 1.9.0+dev-233-g13583a650 and still, I have the same problem. So I simply did what @jonny5532 said, and everything worked: I removed the token from gitea, and then the drone itself made another one in gitea, and everything worked. |
@techknowlogick Just to clarify, is Gitea 1.8.1 Oauth fully working with Drone? |
@xoxys yes it is |
@lafriks Thanks :) |
i can't run drone:latest with gitea:latest, i'm setup oauth2, but drone says: Login Failed. unauthorized_client: client is not authorized |
Which actual versions do you run? Did you manually pull updated images before testing? And what are the steps you used to setup oauth? |
Running both gitea and drone on latest docker images (managed by containrrr/watchtower - which is the newly maintained v2tec/watchtower).
That's it... |
i'm try and it not works. i'm pull latest from drone and gitea now. recheck oauth2 settings but when i'm try auth in drone i get error like before. why gitea returns bad request?
|
@kimpenhaus works like a charm, thanks for the step by step guide! |
@kimpenhaus would you like to post a blog on gitea or send it to docs so that more people could get benefits from your comment? |
@lunny don't you think it would be more beneficial to put it into the drone docs as that's the system that wants to authenticate? I could check if they would accept a pull request on their docs for an addition in oauth2 with gitea. |
@kimpenhaus that's better. |
As i know drone docs sources are not public available for now |
It looks like ... those on github are either archived or deprecated |
Yeah.... |
I still have this problem but found a way to resolve this. However, this is the first and only Google result you get when you google this issue in the most straight forward way so I hope it is okay if I post my solution here. My setup: Drone and Gitea both in docker in their own networks with a shared network used for a reverse proxy via Caddy. Caddy maps subdomains to docker host names so ci.example.com leads to drone and gitea.example.com leads to gitea. I use the domain for the drone gitea configs. I could login via OAuth 2 but then it just said "bla bla :443 no route to host". I fixed this by allowing https in my firewall. Technically this is not necessary because docker is opening all ports you publish but in this case, I had to do it manually. Then I had some other issues with DNS stuff. Since Drone was literally never functional I took the easy way out and stopped all drone containers, deleted everything in the database volume and restarted all drone containers and then it worked flawlessly. |
什么意思?没看懂,dns 如何支持 https ?我的 docker-compose.yaml 已经配置了 https 端口,但是我外部使用 nginx 代理的,没必要 https |
[x]
):Description
Drone no longer works with Gitea as of 1.8.1. Logging into drone is successful in so much as I see it creates an access token in Gitea even after I delete it. After drone logs in and creates the token, it then hits /api/v1/user. Gitea responds with 401 Unauthorized.
I switched back to 1.8.0 as a workaround for now. Sorry I do not have more details. The logs were not very detailed. I suspect some of the auth bug fixes in 1.8.1 could have caused this. Can anyone else confirm drone no longer working with Gitea?
Screenshots
The text was updated successfully, but these errors were encountered: