# Drone 1 with Gitea 1.8: how to login the first time?

**URL:** <https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847>\
**Category:** Drone Support\
**Created:** [May 9, 2019, 6:34pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847 "2019-05-09T18:34:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![qdm12](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/qdm12/32/4979_2.png) [@qdm12](https://drone.discourse.group/u/qdm12)\
**Post date:** [May 9, 2019, 6:34pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/1 "2019-05-09T18:34:16Z")

</div>

Hi all,

I am trying to setup Drone 1 with Gitea 1.8, all running in Docker.  
I have [gitea.domain.com](http://gitea.domain.com) for my Gitea server and [drone.domain.com](http://drone.domain.com) for my Drone, and they both work. I configured everything correctly as far as I can tell. However, I cannot login to Drone and have no idea what the default credentials should be. I tried creating an admin user with the environment variable `DRONE_USER_CREATE=username:quentin,admin:true` but what would be the password? I have also tried with my Gitea credentials but I still get **Login Failed. Forbidden**

The debug log is:

```json
{"level":"info","msg":"main: internal scheduler enabled","time":"2019-05-09T18:31:37Z"}
{"build.limit":0,"expires":"0001-01-01T00:00:00Z","kind":"trial","level":"debug","msg":"main: license loaded","repo.limit":0,"time":"2019-05-09T18:31:37Z","user.limit":0}
{"admin":true,"level":"debug","login":"quentin","machine":false,"msg":"bootstrap: create account","time":"2019-05-09T18:31:37Z","token":""}
{"admin":true,"level":"debug","login":"quentin","machine":false,"msg":"bootstrap: updating account","time":"2019-05-09T18:31:37Z","token":""}
{"admin":true,"level":"debug","login":"quentin","machine":false,"msg":"bootstrap: account already up-to-date","time":"2019-05-09T18:31:37Z","token":""}
{"level":"info","msg":"main: starting the local build runner","threads":2,"time":"2019-05-09T18:31:37Z"}
{"arch":"amd64","level":"debug","machine":"48b9347464f8","msg":"runner: polling queue","os":"linux","time":"2019-05-09T18:31:37Z"}
{"arch":"amd64","level":"debug","machine":"48b9347464f8","msg":"runner: polling queue","os":"linux","time":"2019-05-09T18:31:37Z"}
{"arch":"amd64","kernel":"","level":"debug","msg":"manager: request queue item","os":"linux","time":"2019-05-09T18:31:37Z","variant":""}
{"acme":false,"host":"drone.domain.com","level":"info","msg":"starting the http server","port":":80","proto":"http","time":"2019-05-09T18:31:37Z","url":"http://drone.domain.com"}
{"arch":"amd64","kernel":"","level":"debug","msg":"manager: request queue item","os":"linux","time":"2019-05-09T18:31:37Z","variant":""}
{"interval":"30m0s","level":"info","msg":"starting the cron scheduler","time":"2019-05-09T18:31:37Z"}
{"level":"debug","msg":"events: stream opened","request-id":"1L0YtqoKMqXSdi5ttPa47udJ6ZI","time":"2019-05-09T18:31:39Z"}
{"fields.time":"2019-05-09T18:31:42Z","latency":82003,"level":"debug","method":"POST","msg":"","remote":"10.0.0.2:37830","request":"/login","request-id":"1L0YuEo7MIogdwgpMMkXhSMk08e","time":"2019-05-09T18:31:42Z"}
{"fields.time":"2019-05-09T18:31:42Z","latency":24296,"level":"debug","method":"GET","msg":"","remote":"10.0.0.2:37830","request":"/login/form","request-id":"1L0YuDq7AbgWD5lbbhcGm14NnWC","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"events: stream cancelled","request-id":"1L0YtqoKMqXSdi5ttPa47udJ6ZI","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"events: stream closed","request-id":"1L0YtqoKMqXSdi5ttPa47udJ6ZI","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"api: guest access","request-id":"1L0YtqoKMqXSdi5ttPa47udJ6ZI","time":"2019-05-09T18:31:42Z"}
{"fields.time":"2019-05-09T18:31:42Z","latency":3224501104,"level":"debug","method":"GET","msg":"","remote":"10.0.0.2:37762","request":"/api/stream","request-id":"1L0YtqoKMqXSdi5ttPa47udJ6ZI","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"api: authentication required","request-id":"1L0YuIrKn2O039Tvs8Gjb0D2EDN","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"api: guest access","request-id":"1L0YuIrKn2O039Tvs8Gjb0D2EDN","time":"2019-05-09T18:31:42Z"}
{"fields.time":"2019-05-09T18:31:42Z","latency":156904,"level":"debug","method":"GET","msg":"","remote":"10.0.0.2:37830","request":"/api/user","request-id":"1L0YuIrKn2O039Tvs8Gjb0D2EDN","time":"2019-05-09T18:31:42Z"}
{"level":"debug","msg":"events: stream opened","request-id":"1L0YuK2MBqikdYlSP6GtODeRDTV","time":"2019-05-09T18:31:42Z"}

```

Any suggestion would be greatly appreciated.

Thanks !

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [May 9, 2019, 9:58pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/2 "2019-05-09T21:58:27Z")

</div>

perhaps you are hitting this issue? [https://github.com/go-gitea/gitea/issues/6883](https://github.com/go-gitea/gitea/issues/6883)

---

<div class="post-metadata">

**Author:** ![qdm12](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/qdm12/32/4979_2.png) [@qdm12](https://drone.discourse.group/u/qdm12)\
**Post date:** [May 11, 2019, 6:39pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/3 "2019-05-11T18:39:18Z")

</div>

Thanks for the help! Maybe, actually my Gitea logs out:

```auto
[Macaron] 2019-05-11 18:37:12: Started GET /api/v1/users/quentin/tokens for 10.0.0.29
[Macaron] 2019-05-11 18:37:12: Completed GET /api/v1/users/quentin/tokens 200 OK in 36.786643ms
[Macaron] 2019-05-11 18:37:12: Started GET /api/v1/user for 10.0.0.29
[Macaron] 2019-05-11 18:37:12: Completed GET /api/v1/user 403 Forbidden in 135.835µs

```

Although I can login with user `quentin` and my password on the Gitea webpage.

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/techknowlogick/32/4245_2.png) [@techknowlogick](https://drone.discourse.group/u/techknowlogick)\
**Post date:** [May 12, 2019, 5:13pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/4 "2019-05-12T17:13:45Z")

</div>

Gitea now is an OAuth2 provider, and can more securly offer authentication. Here is some steps on how to connect Drone with Gitea via OAuth2: [[Documentation] Document how Gogs/Gitea login works](http://discuss.harness.io/t/documentation-document-how-gogs-gitea-login-works/3762/7)

---

<div class="post-metadata">

**Author:** ![qdm12](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/qdm12/32/4979_2.png) [@qdm12](https://drone.discourse.group/u/qdm12)\
**Post date:** [May 13, 2019, 10:46am UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/5 "2019-05-13T10:46:18Z")

</div>

After quite some trouble (bad `REDIRECT_URI` especially, see Discord), it now works !

The following instructions are for Drone 1.1 and Gitea 1.8

In this example:

- GITEA\_URL is [https://gitea.domain.com](https://gitea.domain.com)
- DRONE\_URL is [https://drone.domain.com](https://drone.domain.com)

1. Go to your Gitea webpage in the _applications_ section: GITEA\_URL/user/settings/applications
2. In the _Manage OAuth2 Applications_ section, create an application with name _drone_ and Redirect URI DRONE\_URL, then click _Create application_
3. Copy the client ID and client secret and put in your Drone configuration as environment variables `DRONE_GITEA_CLIENT_ID` and `DRONE_GITEA_CLIENT_SECRET`
4. If your Drone is behind a proxy, make sure you have the `DRONE_SERVER_PROTO=https` other you will get the bad redirect URI error from Gitea
5. Now go to DRONE\_URL, and simply Authorize the application

Happy CI !

---

<div class="post-metadata">

**Author:** ![abackstrom](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/abackstrom/32/5657_2.png) [@abackstrom](https://drone.discourse.group/u/abackstrom)\
**Post date:** [June 9, 2019, 2:45pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/6 "2019-06-09T14:45:13Z")

</div>

I had to set “Redirect URI” to `<DRONE_URL>/login` to get the OAuth flow to work.

---

<div class="post-metadata">

**Author:** ![iatsiuk](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/iatsiuk/32/5503_2.png) [@iatsiuk](https://drone.discourse.group/u/iatsiuk)\
**Post date:** [July 20, 2020, 4:00pm UTC](https://drone.discourse.group/t/drone-1-with-gitea-1-8-how-to-login-the-first-time/10847/7 "2020-07-20T16:00:34Z")

</div>

Thank you for sharing your tip, without it i only get an “Unregistered Redirect URI” error.
