There are a few tricks to be aware of. Prompted by a question on stackoverflow.com, I thought I would post my notes here.
Installing restful_authentication
Usually, you will be plugging open_id_authentication into your app's identity management framework. One of the most popular - and the one I've been using of late - is restful_authentication.
Getting restful_authentication working seems to require a few tweaks however - at least for the latest version found up on github.
Firstly, I've had no success directly installing it using the plugin script like this:
ruby script/plugin install git://github.com/technoweenie/restful-authentication.git
Rather, I've had to manually clone the github repository and manually setup the plugin directory:
$ git clone git://github.com/technoweenie/restful-authentication.git
$ mv restful-authentication/ myapp/vendor/plugins/restful_authentication
$ rm vendor/plugins/restful_authentication/.gitignore
$ rm -fR vendor/plugins/restful_authentication/.git
Note that I'm cleaning up some of the git bits, and also changing the plugin directory name to use an underscore rather than a hyphen (Rails usually complains to me otherwise).
Setting up restful_authentication is then pretty straight-forward:
$ mkdir lib
$ ruby script/generate authenticated user sessions
$ rake db:migrate
Note: if you don't already have the 'lib' directory in your application, it must be created first, otherwise the generator will fail.
Installing open_id_authentication
Ryan Bates' Railscast on Openid is the best thing I've found to follow. Even though it was recorded with Rails 1.2.3, I've been able to successfully follow the tutorial with Rails 2.1.0. The only point to note is that for:
gem install ruby-openid
I installed 2.1.2, rather than the 1.1.4 used in railscast.
Installing open_id_authentication is then a doddle.
$ ruby script/plugin install open_id_authentication
Follow the Railscast from this point to integrate OpenID with restful_authentication.
Using restful_authentication on heroku
The plugin installation problems mentioned above also mean that you need to use a few tricks to get it working in a heroku-hosted application. I've found it best to clone your heroku app and add the restful_authentication plugin locally, and then git push it back to heroku when done.
6 comments:
thanks for the easy to follow instructions. I was pulling my hair out a little bit before I came across this.
Happy to hear it made sense Francois!
I really love your instruction. Now I can just follow it step by step instead of going nuts ;)
cool majki, glad it helped
I found the solution to getting things to work with Heroku (Garden), at least with Rails 2.2.2:
Create a "fixtures" directory in /test/, and the generator works for me.
Thanks for useful post.
Post a Comment