Oauth_error with GitHub

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?

Hi !
Can you make sure you have DRONE_HOST=https://... in your settings as shown in 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.

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.

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 :confused:

Already tried that, didnt change anything

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.

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

I have no more ideas then… Sorry man :confused:

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.

1 Like

@bradrydzewski Thank you.

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

in my Apache config.