# Oauth\_error with GitHub

**URL:** <https://drone.discourse.group/t/oauth-error-with-github/8099>\
**Category:** Drone Support\
**Created:** [October 10, 2017, 7:45am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099 "2017-10-10T07:45:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlorianTaut](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/floriantaut/32/3985_2.png) [@FlorianTaut](https://drone.discourse.group/u/FlorianTaut)\
**Post date:** [October 10, 2017, 7:45am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/1 "2017-10-10T07:45:21Z")

</div>

Hey,

i tried to integrate my Drone instance with Github.

Added the `DRONE_GITHUB_CLIENT` and `DRONE_GITHUB_SECRET`.  
Createt a new OAuth App at GitHub and pasted the id and secret.

When i try to Login im recieving the error `oauth_error`.

At this point i upgraded to 0.8 and im still recieving the same error.

Thats the Error printed by drone-server,  
`drone-server_1 | time="2017-10-10T07:36:28Z" level=error msg="cannot authenticate user. redirect_uri_mismatch The redirect_uri MUST match the registered callback URL for this application. https://developer.github.com/v3/oauth/#redirect-uri-mismatch"`

I entered the correct data at GitHub.  
Full URL to server and Callback url with `/authorize` at the end.  
What could cause this error?

Seems like `/authorize` isnt the redirect\_uri anymore?

---

<div class="post-metadata">

**Author:** ![Depado](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/depado/32/3827_2.png) [@Depado](https://drone.discourse.group/u/Depado)\
**Post date:** [October 10, 2017, 8:58am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/2 "2017-10-10T08:58:40Z")

</div>

Hi !  
Can you make sure you have `DRONE_HOST=https://...` in your settings as shown in [http://docs.drone.io/release-0.8.0](http://docs.drone.io/release-0.8.0) ?  
I’m on 0.8.1 and it works fine. Also make sure you don’t have a final slash somewhere in your callback URI.  
Also make sure you have `DRONE_GITHUB` set to true too.

---

<div class="post-metadata">

**Author:** ![FlorianTaut](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/floriantaut/32/3985_2.png) [@FlorianTaut](https://drone.discourse.group/u/FlorianTaut)\
**Post date:** [October 10, 2017, 9:03am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/3 "2017-10-10T09:03:58Z")

</div>

I have all that.  
I extactly followed the docs.

When i manually enter the url to authorize my oauth app it works.  
Just something wrong with the callback.

---

<div class="post-metadata">

**Author:** ![Depado](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/depado/32/3827_2.png) [@Depado](https://drone.discourse.group/u/Depado)\
**Post date:** [October 10, 2017, 9:12am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/4 "2017-10-10T09:12:00Z")

</div>

Did you try deleting the oauth application from Github and recreating it from scratch ?  
I think I faced this issue once and recreating the oauth app worked but I have no idea why. If this doesn’t work I have no idea what you could try next, sorry 😕

---

<div class="post-metadata">

**Author:** ![FlorianTaut](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/floriantaut/32/3985_2.png) [@FlorianTaut](https://drone.discourse.group/u/FlorianTaut)\
**Post date:** [October 10, 2017, 9:12am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/5 "2017-10-10T09:12:41Z")

</div>

Already tried that, didnt change anything

---

<div class="post-metadata">

**Author:** ![Depado](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/depado/32/3827_2.png) [@Depado](https://drone.discourse.group/u/Depado)\
**Post date:** [October 10, 2017, 9:15am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/6 "2017-10-10T09:15:36Z")

</div>

Is your drone in a private network that can’t be accessed from internet ? Maybe that’s the issue. Github will try to interact with your drone server. It’s the only thing I can think of if you’re sure you correctly set everything up.

---

<div class="post-metadata">

**Author:** ![FlorianTaut](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/floriantaut/32/3985_2.png) [@FlorianTaut](https://drone.discourse.group/u/FlorianTaut)\
**Post date:** [October 10, 2017, 9:19am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/7 "2017-10-10T09:19:34Z")

</div>

Its accessible from outsite, already had it running with gogs.

---

<div class="post-metadata">

**Author:** ![Depado](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/depado/32/3827_2.png) [@Depado](https://drone.discourse.group/u/Depado)\
**Post date:** [October 10, 2017, 9:21am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/8 "2017-10-10T09:21:32Z")

</div>

I have no more ideas then… Sorry man 😕

---

<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:** [October 10, 2017, 2:31pm UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/9 "2017-10-10T14:31:20Z")

</div>

> [@On another topic](https://drone.discourse.group/t/841/1):
>
> The redirect\_uri MUST match the registered callback URL for this application.

This error message tells me that the redirect url does not match what is configured in GitHub. The most common root cause for this error is either an incorrect configuration, or putting a reverse proxy or load balancer in front of Drone but no properly cconfiguring the `X-Forwarded-*` headers.

---

<div class="post-metadata">

**Author:** ![FlorianTaut](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/floriantaut/32/3985_2.png) [@FlorianTaut](https://drone.discourse.group/u/FlorianTaut)\
**Post date:** [October 11, 2017, 5:44am UTC](https://drone.discourse.group/t/oauth-error-with-github/8099/10 "2017-10-11T05:44:01Z")

</div>

@bradrydzewski Thank you.

I missed  
`RequestHeader set X-Forwarded-Proto "https"`  
and  
`ProxyPreserveHost On`

in my Apache config.
