# Issues with openid

**URL:** <https://www.ruby-forum.com/t/issues-with-openid/92734>\
**Category:** Rails\
**Created:** [April 23, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/issues-with-openid/92734 "2007-04-23T17:18:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [April 23, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/issues-with-openid/92734/1 "2007-04-23T17:18:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [April 24, 2007, 4:38am UTC](https://www.ruby-forum.com/t/issues-with-openid/92734/2 "2007-04-24T04:38:22Z")

</div>

any idea? 🙂

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [April 24, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/issues-with-openid/92734/3 "2007-04-24T18:46:46Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [April 25, 2007, 4:18am UTC](https://www.ruby-forum.com/t/issues-with-openid/92734/4 "2007-04-25T04:18:28Z")

</div>

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

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?

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [July 16, 2007, 3:44am UTC](https://www.ruby-forum.com/t/issues-with-openid/92734/5 "2007-07-16T03:44:48Z")

</div>

Patrick A. wrote:

> thanx I got to workalready since yesterday and it was because I didn’t  
> install OpenIdAuthentication indeed 🙂
> 
> 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](http://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.
