Marko Anastasov wrote this on October 14, 2010
OmniAuth delivers OAuth2-based authentication done right
With OmniAuth there are no more excuses for not integrating Facebook, Twitter or any popular OAuth2 provider in your login system. That’s because it is Rack middleware, you just need to load it in your app and voilà - going to /auth/twitter
or /auth/facebook
will initiate the authentication request, delivering a hash full of user data to the action covering the /auth/something/callback.
When testing Facebook login in development environment, you might see an error like
{ "error": { "type": "OAuthException", "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration." } }
Facebook requires your callback URL to be on the same domain as the site URL of the Facebook application that is registered to access the information. The solution is to create a dummy app that has site URL http://localhost:3000/
(note the trailing slash).