Topic: Omniauth and OpenID

Hi,
I am using Omniauth in a Rails 3 application for OpenID logins. Pretty much the same way as the last episode of Railscasts, but with normal OpenID instead of Twitter (http://railscasts.com/episodes/241-simple-omniauth). Everything works fine, but when I go to auth/open_id to login I am presented with a login page to enter my OpenID, how can I customize this page, or replace it with a page of my own?

Thanks!

Re: Omniauth and OpenID

I don't how you can customize the OpenID entry page, but it does appear that you can bypass it.  I set up my own page to accept user identifier and then I passed it to auth/open_id.

:openid_url => "your_open_id_identifier"

I found this at https://github.com/intridea/omniauth/wi … oogle-Apps under "Specifying a Provider".  It doesn't really say that this is the intended use, but it seems to work fine for me.

HTH

Re: Omniauth and OpenID

Thanks for the help, that works, but often I get an error:

ActionController::InvalidAuthenticityToken in SessionsController#create

I created a new method in my sessions controller

def redirect_to_provider
  redirect_to '/auth/open_id?openid_url=' + params[:openid_identifier]
end

Added this to the routes.rb file

match 'sessions/redirect_to_provider' => 'sessions#redirect_to_provider', :as => :redirect_to_provider

And created a new file, views/sessions/new.html.erb

<%= form_tag redirect_to_provider_path do %>
  ...
  <%= text_field_tag :openid_identifier %>
  ...
  <%= submit_tag 'Sign in', :disable_with => 'Signing in...'%>
  ...
<% end %>

This works, but as I said I often get the error message mentioned above. Is this similar to what you did, or how did you do this?

Re: Omniauth and OpenID

I fixed the problem. I was doing things too complicated with the method in the sessions controller and the entry in the routes.rb file.

I just need to create the file views/sessions/new.html.erb like this:

<%= form_tag '/auth/open_id' do %>
  ...
  <%= text_field_tag :openid_url %>
  ...
  <%= submit_tag 'Sign in', :disable_with => 'Signing in...'%>
  ...
<% end %>

When I read your post again now I guess this is what you originally was trying to tell me, but I just had to complicate things wink