# Rails + Authlogic + OpenID

**URL:** <https://www.ruby-forum.com/t/rails-authlogic-openid/182991>\
**Category:** Rails\
**Created:** [February 5, 2010, 6:16pm UTC](https://www.ruby-forum.com/t/rails-authlogic-openid/182991 "2010-02-05T18:16:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnicolaou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7bcc69/32.png) [@cnicolaou](https://www.ruby-forum.com/u/cnicolaou)\
**Post date:** [February 5, 2010, 6:16pm UTC](https://www.ruby-forum.com/t/rails-authlogic-openid/182991/1 "2010-02-05T18:16:08Z")

</div>

Hi,

I’ve been trying to add a feature to an existing rails app written  
using rails 2.3.4 and uses Authlogic for authentication to  
authenticate using openid. I added Authlogic-oid and ruby-openid and  
tried to get openid to work with both AX and sreg schemas.

I followed many examples online (railscasts). Authentication is done  
using email originally so login column was dropped.

When used with [myopenid.com](http://myopenid.com) provider, the registration process is  
working like a charm, skipping password and storing the values in the  
tables locally. When used with yahoo or google, an error occurs and i  
keep getting “Openid identifier had the following error: Sorry, the  
OpenID server couldn’t be found”

My user.rb code looks like the following:

acts\_as\_authentic do |config|  
config.disable\_perishable\_token\_maintenance = true  
config.validate\_login\_field = false  
config.validate\_email\_field = false  
# Google uses AX  
config.openid\_required\_fields = [  
“[http://axschema.org/contact/](http://axschema.org/contact/)  
email”,  
“[http://axschema.org/namePerson/](http://axschema.org/namePerson/)  
first”,  
“[http://axschema.org/namePerson/](http://axschema.org/namePerson/)  
last”  
]  
# # Other providers use sreg  
config.openid\_optional\_fields = [  
:email,  
:nickname  
]  
end

Also, when checking against yahoo or google, the see the following  
warning and error logs:

WARNING: making https request to  
[https://open.login.yahooapis.com/openid/op/auth](https://open.login.yahooapis.com/openid/op/auth)  
without verifying server certificate; no CA path was specified.  
[OPENID] Unable to contact OpenID server: Error fetching  
[https://open.login.yahooapis.com/openid/op/auth:](https://open.login.yahooapis.com/openid/op/auth:) You have a nil object  
when you didn’t expect it!  
The error occurred while evaluating [nil.io](http://nil.io)

That was the registration process.

Now when a successful registration is made and the user tries to log  
in, the session is not created properly yielding an error of “no  
credentials”

Is anyone facing a similar problem? Tried to contact Ben of  
binarylogic, the author of authlogic but received not response.

The aim is to get both openid authentication and local authentication  
working together smoothly. Now local authentication is working, but  
openid is not.

---

<div class="post-metadata">

**Author:** ![cnicolaou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7bcc69/32.png) [@cnicolaou](https://www.ruby-forum.com/u/cnicolaou)\
**Post date:** [June 10, 2010, 1:40am UTC](https://www.ruby-forum.com/t/rails-authlogic-openid/182991/2 "2010-06-10T01:40:11Z")

</div>

try the following:  
a) gem install ruby-openid-apps-discovery  
b) Modify config/environment.erb and add this line  
require ‘gapps\_openid’

I wrote a blogpost about what I went through to get open-id to work with  
google:  
[http://toddsedano.blogspot.com/](http://toddsedano.blogspot.com/)

I’m now in the process of integrating my code with authlogic
