title: Rails: Omniauth: Github provider doesn't quite work
body: <p>I recently forked <a href="https://github.com/fortuity/rails3-mongoid-omniauth" rel="nofollow">https://github.com/fortuity/rails3-mongoid-omniauth</a> and tried to get login working for different providers. It works for Twitter and Facebook (You can try it out at <a href="http://jgodse-omniauth-mongoid.heroku.com/" rel="nofollow">http://jgodse-omniauth-mongoid.heroku.com/</a>), but I couldn't get it working for Github. The code snapshot is <a href="https://github.com/jgodse/rails3-mongoid-omniauth/tree/bc52912411b9674b0f0efe1615dbaf7ecc02a000" rel="nofollow">here at github</a>. </p>
  
  <p>My environment looks like this:</p>
  
  <pre><code>$ heroku info
  === jgodse-omniauth-mongoid
  Web URL:        http://jgodse-omniauth-mongoid.heroku.com/
  Git Repo:       git@heroku.com:jgodse-omniauth-mongoid.git
  Dynos:          1
  Workers:        0
  Repo size:      7M
  Slug size:      5M
  Stack:          bamboo-mri-1.9.2
  Data size:      (empty)
  Addons:         Basic Logging, MongoHQ MongoHQ Free, Shared Database 5MB
  Owner:          xxxxx@yyy.com
  
  Jay@JAY-PC ~/rapps/rails3-mongoid-omniauth (master)
  $ heroku config --long
  BUNDLE_WITHOUT      =&gt; development:test
  DATABASE_URL        =&gt; postgres://xxxxxxxxxxxxxxxxxxxx.compute-1.amazonaws.com/rrretnhwhj
  FACEBOOK_APP_ID     =&gt; xxxxxxxxxxxxxxxxxxxx
  FACEBOOK_APP_SECRET =&gt; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  GITHUB_CLIENT_ID    =&gt; xxxxxxxxxxxxxxxxxxxxx
  GITHUB_SECRET       =&gt; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  LANG                =&gt; en_US.UTF-8
  MONGOHQ_URL         =&gt; mongodb://heroku:9xxxxxxxxxxxxxxxx.mongohq.com:27098/app527030
  RACK_ENV            =&gt; production
  SHARED_DATABASE_URL =&gt; postgres://xxxxxxxxxxxxxxxxxxxxx.compute-1.amazonaws.com/rrretnhwhj
  TWITTER_KEY         =&gt; xxxxxxxxxxxxxxxxxxx
  TWITTER_SECRET      =&gt; xxxxxxxxxxxxxxxxxxxxxxxxxxxx
  </code></pre>
  
  <p>My github information for "OAuth Application: Jay's Rails3 Mongoid OAuth" is as follows (from my app profile page):</p>
  
  <pre><code>Authorization Token:   https://github.com/login/oauth/authorize
  Access Token URL:      https://github.com/login/oauth/access_token
  URL:     http://jgodse-omniauth-mongoid.heroku.com/
  Callback URL:   http://jgodse-omniauth-mongoid.heroku.com/
  Client ID: xxxxxxx
  Secret:    xxxxxxxxxxxxxxxx
  </code></pre>
  
  <p>The client and secret are set as environment variables in <a href="https://github.com/jgodse/rails3-mongoid-omniauth/blob/bc52912411b9674b0f0efe1615dbaf7ecc02a000/config/initializers/omniauth.rb" rel="nofollow">omniauth.rb</a></p>
  
  <p>The authentication happens, but it redirects to <a href="http://jgodse-omniauth-mongoid.heroku.com/?error=redirect_uri_mismatch" rel="nofollow">http://jgodse-omniauth-mongoid.heroku.com/?error=redirect_uri_mismatch</a> and I haven't apparently logged in. If I change the Callback URL to <a href="http://jgodse-omniauth-mongoid.heroku.com/callback" rel="nofollow">http://jgodse-omniauth-mongoid.heroku.com/callback</a>, the application crashes. </p>
  
  <p>What am I missing to get github authentication to work?</p>