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).

comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.

Contact

Rendered Text is a software company. For questions regarding Semaphore, please visit semaphoreci.com. Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad
Serbia