title: How to setup drone server to work with github oauth
body: <p>I am trying to setup a local drone server to be used as our CI environment. Our source code is managed by Github. 
  First, I create an oauth application on Github and get the client_id and client_secret. 
  Then install docker and drone, after that I did below configuration on <code>/etc/drone/dronerc</code></p>
  
  <pre><code>REMOTE_DRIVER=github
  REMOTE_CONFIG=https://github.com?client_id=XXXXXX&amp;client_secret=XXXXXX
  DATABASE_DRIVER=sqlite3
  DATABASE_CONFIG=/var/lib/drone/drone.sqlite
  </code></pre>
  
  <p>Then I run below command to start drone docker container:</p>
  
  <pre><code>sudo docker run \
    --volume /var/lib/drone:/var/lib/drone \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --env-file /etc/drone/dronerc \
    --restart=always \
    --publish=80:8000 \
    --detach=true \
    --name=drone \
    drone/drone:0.4
  </code></pre>
  
  <p>I access the drone link on the browser, I can see a login button. As shown below.</p>
  
  <p><a href="https://i.stack.imgur.com/u1blO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u1blO.png" alt="enter image description here"></a></p>
  
  <p>When I click on the login button, my callback url is notified with below error message:</p>
  
  <pre><code>error=redirect_uri_mismatch&amp;error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.
  </code></pre>
  
  <p>Below is the server code for the Github callback url:</p>
  
  <pre><code>get '/oauth/authorize' do
    # get temporary GitHub code...
    session_code = request.env['rack.request.query_hash']['code']
  
    # ... and POST it back to GitHub
    result = RestClient.post('https://github.com/login/oauth/access_token',
                            {:client_id =&gt; CLIENT_ID,
                             :client_secret =&gt; CLIENT_SECRET,
                             :code =&gt; session_code},
                             :accept =&gt; :json)
  
    # extract the token and granted scopes
    access_token = JSON.parse(result)['access_token']
    redirect 'http://10.0.0.24/'
  end
  </code></pre>
  
  <p>In the last line of the above code, the redirect address is drone server address.
  I may be do a wrong thing on the OAuth authentication part but I don't know how to do that in a correct way. Does anyone know how to implement that part to allow drone to get access on my Github account?</p>
  
  <p>Thanks</p>