Issues with openid

hey,

I’m trying to use openid but I always get that “undefined method
`using_open_id?’” I did put require ‘openid’ on top of my controller,
is there anything else I should include?

this is my checklogin function:

def checklogin
if using_open_id?
open_id_authentication
elsif params[:login]
password_authentication(params[:login], params[:password])
end
end

thanx in advance

Pat

any idea? :slight_smile:

Patrick A. wrote:

hey,

I’m trying to use openid but I always get that “undefined method
`using_open_id?'” I did put require ‘openid’ on top of my controller,
is there anything else I should include?

this is my checklogin function:

def checklogin
if using_open_id?
open_id_authentication
elsif params[:login]
password_authentication(params[:login], params[:password])
end
end

thanx in advance

Pat

More information would be helpful, but let’s try this.

Your error is telling us that using_open_id? is not a method of the
containing class (I’m going to guess that this is in class
ApplicationController < ActionController::Base). So, why not?

Without more information it’s impossible to say. A web search says that
you are trying to use the OpenID Authentication Plugin as described at
http://www.bencurtis.com/archives/2007/03/rails-openid-and-acts-as-authenticated
(your code is identical)

If this is the case, the first thing I’d check into is that the plugin
is installed correctly. Can you prove that it is loading with rails?
Do you need to run install.rb? Do you have the dependencies installed?

I will quote “Bob” in that in the forum listed above who had the same
problem:

Ah – I missed all the hidden steps of installing the open_id_authentication plugin, running migrations, setting index_url, etc. It’s still not clear in the code how one signs up with an OpenID URL – it takes more than simply adding an openid_url field in signup.rhtml

Note: I’m trying to get OpenID working with a Role based Authentication
system as well and I haven’t been successful yet. Anyone else who can
shed light on "all the hidden steps

John M.

thanx I got to workalready since yesterday and it was because I didn’t
install OpenIdAuthentication indeed :slight_smile:

I still have a problem though, though it allows the user to login, it
won’t create it in the database:

I use this function:
def open_id_authentication
authenticate_with_open_id do |result, identity_url|
if result.successful?
if self.current_user =
User.find_or_create_by_identity_url(identity_url)
redirect_to(:action => ‘login’)
flash[:warning] = message
else
failed_login “Sorry, no user by that identity URL exists
(#{identity_url})”
end
else
failed_login result.message
end
end
end

and that part:
if self.current_user =
User.find_or_create_by_identity_url(identity_url)
redirect_to(:action => ‘login’)

seems to be ignored for some reason.

any idea what’s wrong?

Patrick A. wrote:

thanx I got to workalready since yesterday and it was because I didn’t
install OpenIdAuthentication indeed :slight_smile:

I still have a problem though, though it allows the user to login, it
won’t create it in the database:

I use this function:
def open_id_authentication
authenticate_with_open_id do |result, identity_url|
if result.successful?
if self.current_user =
User.find_or_create_by_identity_url(identity_url)
redirect_to(:action => ‘login’)
flash[:warning] = message
else
failed_login “Sorry, no user by that identity URL exists
(#{identity_url})”
end
else
failed_login result.message
end
end
end

and that part:
if self.current_user =
User.find_or_create_by_identity_url(identity_url)
redirect_to(:action => ‘login’)

seems to be ignored for some reason.

any idea what’s wrong?

Do you have any validations in your model that might be preventing
account creation? I had to ad :if => :not_openid? to the end of most of
my validations. ie.with OpenID login, you won’t have a username,
password, password-length will be too short, etc.

However, mine works only in development mode. In production, it appears
as though I’m getting the same response from myopenid.com, but it throws
an error “connection refused - connect(2)”. Upon page refresh, the site
comes back and the flash shows “Sorry, the openid verification failed.”
I can restart the server in development mode and it works again.