Clean OAuth for Rails: An Object-Oriented Approach

While Ruby's OAuth gems do go a long way towards making OAuth implementation with Rails a pain-free process, the standard method of implementation rapidly breaks down on a full scale production app when User validations and logic begin conflicting with the information we receive from OAuth.

In this tutorial, we will take an object-oriented approach, separating logic for OAuth users from logic for non-OAuth users to create a robust and stable OAuth implementation that is clean, sturdy, and will not break down as you add functionality to your app's user objects.

Note: This tutorial is intended for programmers who have implemented OAuth for Rails before and are looking for a better way to do so. It is not a beginner's tutorial. It assumes the reader already has knowledge of the OAuth gems and how to integrate them into a Rails app.