Using Rails ActiveResource via OAuth2

Exposing Resources via a REST interface can be a nice way to split-off certain
parts of a larger Rails application. To consume those,
ActiveResource has been a nice way to go
for quite some time now, and still is in my opinion even thought with Rails 4 it
will move to its own gem and be no longer tied to Rails Core (good or bad?).

One hurdle left is that in some cases resources are, or
should be protected. In this case working with OAuth2 for example is quite easy
the only thing needed is setting a header.

https://gist.github.com/3820532.js

The token obtained for example via Omniauth and then set in the Controller. So
thats it now using the Resource works just as using an ActiveRecord Model.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s