views:

527

answers:

2

Hello,

I'm wondering how to go about using Authlogic to auto register a user who chooses to use open id. Right now they have to register first before being able to login in, even if they choose open id, but I'd prefer if they could just login directly provided I get all the necessary details from the open id provider. But I'm not sure how to go about doing this?

Would I do it inside my user session controller or is there some fancy way to extend authlogic inside the model?

If someone could point me in the right the direction, i'd be grateful.

Here's an example of what I have now with the two pages:

http://morning-warrior-55.heroku.com/

Thanks,

+1  A: 

You have to use auto_register method in your UserSession model. Although i did try to solve the very same question. I succeeded with first time login/registration only.

Second time when user tries to login, the system tries to register it again.

Eimantas
i added auto_register to my UserSession model but I got "undefined local variable or method `auto_register' for UserSession:Class"... I have the Authlogic 2.1.2 and Authlogic-oid 1.0.4
holden
You need authlogic-openid addon: http://github.com/binarylogic/authlogic_openid
Eimantas
isn't this the same as "config.gem "authlogic-oid", :lib => "authlogic_openid"?
holden
i did notice the plug-in appears to be more recently updated than the gem and they added that feature. but after removing the gem from my environment and installing the plugin it behaves weirdly. It gave me an error that my create.html page doesn't exist (which is true) but the controller doesn't pass the user to the create view in either the case of failure or success and it worked just fine as the gem. It also doesn't process the openid at all... at least in the user session, works fine in the user model. all which worked fine under the gem.
holden
yeah, it's kinda buggy with little documentation and/or tutorials. So i guess i'll just wait for a more stable version. I don't know if that's an option for you though...
Eimantas
+2  A: 

Gaizka's version seems to work beautifully for me.

http://github.com/gaizka/authlogic_openid

Thanks, here's the example of it working:

http://big-glow-mama.heroku.com/

http://github.com/holden/authlogic_openid_selector_example/tree/with-facebook/

holden