# 401 Unauthorized

**URL:** <https://drone.discourse.group/t/401-unauthorized/10664>\
**Category:** Drone Support\
**Created:** [March 25, 2019, 7:01am UTC](https://drone.discourse.group/t/401-unauthorized/10664 "2019-03-25T07:01:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kxw07](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/kxw07/32/3715_2.png) [@kxw07](https://drone.discourse.group/u/kxw07)\
**Post date:** [March 25, 2019, 7:01am UTC](https://drone.discourse.group/t/401-unauthorized/10664/1 "2019-03-25T07:01:12Z")

</div>

Hi All,  
I logon failed when using Drone:1.0.0.rc-5 with Gitlab 11.8.2  
Docker-compose config works on Drone:1.0.0.rc-5 with Gitlab 9.4.4

Here are some information:  
Drone page:

```auto
Login Failed. <small>invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.</small>

```

Gitlab log:

```auto
Processing by Oauth::AuthorizationsController#new as HTML
  Parameters: {"client_id"=>"7b187055e25cdf442a1b37a2e9152950820bc4a8949c0e187c8bc8b533a79547", "redirect_uri"=>"http://10.20.8.78:8000/login", "response_type"=>"code", "state"=>"365a858149c6e2d1"}
Completed 200 OK in 41ms (Views: 26.7ms | ActiveRecord: 6.2ms)
Started GET "/oauth/undefined" for 127.0.0.1 at 2019-03-25 12:53:24 +0800
Processing by ApplicationController#route_not_found as HTML
  Parameters: {"unmatched_route"=>"oauth/undefined"}
Completed 404 Not Found in 17ms (Views: 2.4ms | ActiveRecord: 3.1ms)
Started POST "/oauth/authorize" for 127.0.0.1 at 2019-03-25 12:53:26 +0800
Processing by Oauth::AuthorizationsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "client_id"=>"7b187055e25cdf442a1b37a2e9152950820bc4a8949c0e187c8bc8b533a79547", "redirect_uri"=>"http://10.20.8.78:8000/login", "state"=>"365a858149c6e2d1", "response_type"=>"code", "scope"=>"api", "nonce"=>""}
Redirected to http://10.20.8.78:8000/login?code=16a6b023ca011743d44d974cb08f287dabd23a3e54a938f73260ab72c9df2cce&state=365a858149c6e2d1
Completed 302 Found in 35ms (ActiveRecord: 23.7ms)
Started POST "/oauth/token" for 127.0.0.1 at 2019-03-25 12:53:26 +0800
Processing by Doorkeeper::TokensController#create as JSON
  Parameters: {"client_id"=>"7b187055e25cdf442a1b37a2e9152950820bc4a8949c0e187c8bc8b533a79547", "client_secret"=>"[FILTERED]", "code"=>"[FILTERED]", "grant_type"=>"authorization_code", "redirect_uri"=>"http://10.20.8.78:8000/login", "state"=>"365a858149c6e2d1"}
Completed 401 Unauthorized in 5ms

```

---

<div class="post-metadata">

**Author:** ![kxw07](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/kxw07/32/3715_2.png) [@kxw07](https://drone.discourse.group/u/kxw07)\
**Post date:** [March 27, 2019, 10:51am UTC](https://drone.discourse.group/t/401-unauthorized/10664/2 "2019-03-27T10:51:50Z")

</div>

I think is image problem.  
I use official image [gitlab/gitlab-ce:11.8.3-ce.0] works with drone.  
But [sameersbn/gitlab:11.8.3] doesn’t…

Here is my docker run command:

```auto
docker run --name gitlab_test -d \
--link gitlab-postgresql:postgresql \
--link gitlab-redis:redisio \
--publish 30003:22 --publish 30002:80 \
--env 'GITLAB_PORT=30002' --env 'GITLAB_SSH_PORT=30003' \
--env 'GITLAB_HOST=10.20.8.14' \
--env 'GITLAB_SECRETS_DB_KEY_BASE=gpnLWjJPFr39f3NLwsLXsFnkV7RKXjVC3qWWVJd9f9xJHkXkjbv3nT7LwnbVmKrs' \
--env 'GITLAB_SECRETS_SECRET_KEY_BASE=XJMdsknXH3JppptbvqNpvtNLjRsLrsR4zPTpLcdkcgMMggTWLF7nMpMsfrcRkLxx' \
--env 'GITLAB_SECRETS_OTP_KEY_BASE=PwbjRLCRjNMK44jzdhzTM7KqTgCJjKzHJJ7ptqXdgq7xnkpWTjsNXfqnPhmJLmhW' \
--env 'DEBUG=true' \
-v /etc/localtime:/etc/localtime:ro \
-v /usr/local/docker/gitlab/gitlab:/home/git/data:z \
sameersbn/gitlab:11.8.3

```

---

<div class="post-metadata">

**Author:** ![kxw07](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/kxw07/32/3715_2.png) [@kxw07](https://drone.discourse.group/u/kxw07)\
**Post date:** [March 28, 2019, 3:14am UTC](https://drone.discourse.group/t/401-unauthorized/10664/3 "2019-03-28T03:14:55Z")

</div>

Never mind.  
That’s gitlab problem of upgrading db schema.  
And 401 Unauthorized is caused by timezone.

---

<div class="post-metadata">

**Author:** ![kxw07](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/kxw07/32/3715_2.png) [@kxw07](https://drone.discourse.group/u/kxw07)\
**Post date:** [March 28, 2019, 9:39am UTC](https://drone.discourse.group/t/401-unauthorized/10664/4 "2019-03-28T09:39:45Z")

</div>

After I changed db oauth’s table timestamp column without time zone,  
It works.

So I think it caused by gitlab and db at different timezone.
