• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

OpenIdAuthentication is depend on gem ruby-openid 1.1.4. In addition, ruby-openid 1.1.4 is broken with 1.0.1 gem :(
So, I applied patch(Ticket#10604) and they works well.

  1. Install gem ruby-openid(2.0.4)
    shell>>
    gem install ruby-openid
    <<--

  2. Install plugin
    shell>>
    $ ./script/plugin install http://svn.rubyonrails.org/rails/plugins/open_id_authentication/
    <<--

  3. Apply patch

  • Get a patch and save as ticket10604.diff

http://dev.rubyonrails.org/ticket/10604

  • Move diff file to plugin root
    shell>>

#{RAILS_ROOT}/vendor/plugins/open_id_authentication/ticket10604.diff
<<--

  • Move to plugin root and do patch command
    shell>>
    $ patch -p1 < ticket10604.diff
    patching file init.rb
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file init.rb.rej
    patching file lib/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb
    patching file lib/generators/open_id_authentication_tables/templates/migration.rb
    patching file lib/open_id_authentication.rb
    Hunk #5 succeeded at 69 with fuzz 1 (offset -2 lines).
    Hunk #6 succeeded at 88 (offset -2 lines).
    Hunk #7 succeeded at 152 (offset -2 lines).
    patching file lib/open_id_authentication/association.rb
    patching file lib/open_id_authentication/db_store.rb
    patching file lib/open_id_authentication/nonce.rb
    patching file lib/open_id_authentication/setting.rb
    patching file tasks/open_id_authentication_tasks.rake
    patching file test/normalize_test.rb
    patching file test/open_id_authentication_test.rb
    patching file test/status_test.rb
    <<--
  1. Do some work in README
  • Creating tables
    shell>>
    rake open_id_authentication:db:create
    <<--

  • Add some routes
    rails>>

#config/routes.rb
map.open_id_complete 'session', :controller => "sessions", :action => "create", :requirements => { :method => :get }
map.resource :session
<<--

  • Generate SessionsController, and create vews/sessions/new.html.erb
    Tip:NOT to use sample code in agilewebdevelopment.com. Use sample code in README.
    rails>>
    def open_id_authentication
    authenticate_with_open_id do |result, identity_url|
    if result.successful? && @current_user = @account.users.find_by_identity_url(identity_url)
    successful_login
    else
    failed_login(result.message || "Sorry, no user by that identity URL exists (#{identity_url})")
    end
    end
    end
    <<--
  1. Ommit version of ruby-openid
    rails>>

#open_id_authentication/init.rb
begin

gem 'ruby-openid', '=1.1.4'

gem 'ruby-openid'
<<--

posted by hibi hibi on Wed 27 Feb 2008 at 17:12 with 2 comments
I can't get it to work! I get redirected to yahoos openid site, and I click "Let me in", and I get back to my rails app, but always with the flash-error: OpenID verification failed

Using ruby-openid 2.0.4, and the OpenidAuth-plugin is installed from within Aptana and is already patched. Any idea?
satoko satoko 05/01 20:07
In my app fail too. But authentication with yahoo is SUCCESS, but myapp has fail becase yahoo doesn't provide any infomation(like email, nickname...) which is necessaly for the app.

rails >>
logger.debug status.successful? #=>true
logger.debug registration[:nickname] #=> this will fail
logger.debug registration[:email] #=> this will fail too
<<--