Ruby on Rails
OpenidLoginGenerator

Available as part of the Ruby OpenID library. See the OpenID page for more information (revert to version 211 if the page is clogged with spam.) This generator is based on the LoginGenerator, and behaves works the exact same way, except uses OpenID for authentication instead of passwords.

Install

gem install openid_login_generator

Run the generator

./script/generate openid_login auth

Testing it out

Follow the instructions for updating your User model in the README_LOGIN file generated in the root of your rails app.

Start your webserver and go to http://localhost:3000/auth/login to test it out.

Error

If you leave the login blank, then you get this error:

NoMethodError in AuthController#login
You have a nil object when you didn't expect it!
The error occured while evaluating nil.chr

So, in your auth_controller, substitute this

  def login
    openid_url = @params[:openid_url]
    if (@request.post?)

with this

  def login
    openid_url = @params[:openid_url]
    if openid_url=="" 
      flash[:notice] = "Don't leave your name blank." 
    elsif (@request.post?)

It doesn’t look brilliant, but it’s a fast workaround for now.

Error

% ./script/generate openid_login openid_account            
Couldn't find 'openid_login' generator

I have installed the gem.

Rails 2.0

Would anyone possibly give recommendations as to upgrading this plugin for rails 2.0, as much of the code is obsolete now. Thanks very much.