I recently split https://github.com/fortuity/rails3-mongoid-omniauth and tried to get the login to work for different providers. It works for Twitter and Facebook (you can try it http://jgodse-omniauth-mongoid.heroku.com/ ), but I could not get it to work on Github. Snapshot of the code here on github .
My environment is as follows:
$ 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 => development:test DATABASE_URL => postgres://xxxxxxxxxxxxxxxxxxxx.compute-1.amazonaws.com/rrretnhwhj FACEBOOK_APP_ID => xxxxxxxxxxxxxxxxxxxx FACEBOOK_APP_SECRET => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx GITHUB_CLIENT_ID => xxxxxxxxxxxxxxxxxxxxx GITHUB_SECRET => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx LANG => en_US.UTF-8 MONGOHQ_URL => mongodb://heroku:9xxxxxxxxxxxxxxxx.mongohq.com:27098/app527030 RACK_ENV => production SHARED_DATABASE_URL => postgres://xxxxxxxxxxxxxxxxxxxxx.compute-1.amazonaws.com/rrretnhwhj TWITTER_KEY => xxxxxxxxxxxxxxxxxxx TWITTER_SECRET => xxxxxxxxxxxxxxxxxxxxxxxxxxxx
My github information for "OAuth Application: Jay Rails3 Mongoid OAuth" looks like this (from my application profile page):
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
Client and secret are set as environment variables in omniauth.rb
Authentication happens, but it redirects to http://jgodse-omniauth-mongoid.heroku.com/?error=redirect_uri_mismatch , and I obviously did not log in. If I change the callback URL to http://jgodse-omniauth-mongoid.heroku.com/callback , the application crashes.
What am I missing to authenticate github?
source share