Authlogic with Facebook Connect -- integration issues

11 views
Skip to first unread message

Galen

unread,
Nov 18, 2009, 7:08:37 AM11/18/09
to Authlogic
Hi,

I have previously used Authlogic on my site. Now I've got 40 users and
want to integrate facebook connect.

I spent the past six hours following Kalasjocke's installation
instructions and now my setup mirrors his exactly, as far as I can
tell. However, when I click the Connect button (on my development
platform, tunneled from my remote server) the User does not create --
nothing changes in the database. The facebook dialog does appear, I
click connect, the box either a) disappears and nothing happens or b)
the box redirects to my site *inside itself* or c) it redirects
somewhere, and the flash[:notice] says, "Username or Password
Incorrect" or d) it redirects to my root url and nothing happens in
the database.

I'm thinking there's something I need to change in my User model, to
accommodate facebook. Could someone paste their create action and
their before_connect hook so I can see if I'm missing something?

I've been all over google and stack_overflow with no results.
Kalasjocke's instructions apparently work seamlessly for most people.
I'm not sure what I'm missing.

Thanks,
Galen

Galen

unread,
Nov 19, 2009, 2:02:38 AM11/19/09
to Authlogic
Turns out 3 of the four behaviors were because I'd placed the
authlogic_facebook_login_button on a page other than user_sessions =>
new.

So now I've narrowed it down to an "Invalid username or password"
response when I click the facebook login button.

I'm under the impression (and have read elsewhere) that authlogic
shouldn't attempt to validate the login, password or email if the user
attempts to login via facebook.

Is there a setting I need to change to ensure that happens?

One item that may be pertinent: I modified my UserSession model to use
a different find_by_login_method.
It now looks like this: find_by_login_method :find_by_login_or_email

In my User model I define this:

def self.find_by_login_or_email(login)
User.find_by_login(login) || User.find_by_email_address(login)
end

This is how I allow users to login via email address. Could this be
conflicting with facebook_connect?

I removed the find_by_login_method from the UserSession model, and
nothing changed, but I'm curious nonetheless.

Thanks again! Authlogic's been a life-simplifier. Now if I can just
get it working with facebook.

Cheers,
Galen

On Nov 18, 9:08 pm, Galen <withga...@gmail.com> wrote:
> Hi,
>
> I have previously used Authlogic on my site. Now I've got 40 users and
> want to integratefacebookconnect.
>
> I spent the past six hours following Kalasjocke's installation
> instructions and now my setup mirrors his exactly, as far as I can
> tell. However, when I click theConnectbutton (on my development
> platform, tunneled from my remote server) the User does not create --
> nothing changes in the database. Thefacebookdialog does appear, I
> clickconnect, the box either a) disappears and nothing happens or b)
> the box redirects to my site *inside itself* or c) it redirects
> somewhere, and the flash[:notice] says, "Username or Password
> Incorrect" or d) it redirects to my root url and nothing happens in
> the database.
>
> I'm thinking there's something I need to change in my User model, to
> accommodatefacebook. Could someone paste their create action and

Emmanuel P

unread,
Dec 3, 2009, 1:52:50 PM12/3/09
to Authlogic
Hey, I'm curious if you ever got this to work. I am having the same
exact issue. Login dialogue appears, I input my credentials, it closes
but nothing happens. It's as if it doesn't know where the callback is
or something.

I have all this setup in my facebooker.yml

Let me know, thanks.

Galen

unread,
Dec 3, 2009, 8:43:13 PM12/3/09
to Authlogic
I got it a step closer, but I'm having a new issue with
authlogic_facebook_connect where it claims session.rb has an undefined
method "new_user".

Do you mind if I ask what you did to get it to work?

Also, what callback URLs did you use? I'm wondering if mine are set
wrong.

I have the post-auth callback url set to mysite.com/users and the post-
auth redirect set to mysite.com/account

Cheers,
Galen

Jocke Ekberg

unread,
Dec 4, 2009, 7:31:37 AM12/4/09
to auth...@googlegroups.com
Hi Galen,

There were a bug in the latest version of the code wish caused the
"new_user"-issue, just update and you will be all right!

--
Joakim
http://www.joakimekberg.se/
> --
>
> You received this message because you are subscribed to the Google Groups "Authlogic" group.
> To post to this group, send email to auth...@googlegroups.com.
> To unsubscribe from this group, send email to authlogic+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/authlogic?hl=en.
>
>
>

skylarking 420

unread,
Dec 4, 2009, 6:50:28 PM12/4/09
to auth...@googlegroups.com
Had the same problem while working with authlogic fb connect. Actually I patched the original authlogic fb connect since I was working to an extension for spree, and I've found out that you actually have to add the object like so (mine was on line 102 in session.rb).
After that you should be ready to go.

new_user = klass.new

Galen

unread,
Dec 4, 2009, 9:22:46 PM12/4/09
to Authlogic
Yep, Joakim, the newest patch fixed that bug.

However, now I'm receiving this error:

NoMethodError (undefined method `facebook_session_key=' for #<User:
0xba0aaf4>):
authlogic (2.1.2) lib/authlogic/session/callbacks.rb:72:in
`validate'
authlogic (2.1.2) lib/authlogic/session/validation.rb:64:in `valid?'
authlogic (2.1.2) lib/authlogic/session/existence.rb:65:in `save'
app/controllers/user_sessions_controller.rb:12:in `create'

Do I need to update by database schema in some way to allow a place to
save the facebook_session_key?

It seems like this should be a temporary method though...

Cheers,
Galen
On Dec 5, 8:50 am, skylarking 420 <skylarking...@gmail.com> wrote:
> Had the same problem while working with authlogic fb connect. Actually I
> patched the original authlogic fb connect since I was working to an
> extension for spree, and I've found out that you actually have to add the
> object like so (mine was on line 102 in session.rb).
> After that you should be ready to go.
>
> new_user = klass.new
>
> On Fri, Dec 4, 2009 at 1:31 PM, Jocke Ekberg <jocke.ekb...@gmail.com> wrote:
> > Hi Galen,
>
> > There were a bug in the latest version of the code wish caused the
> > "new_user"-issue, just update and you will be all right!
>
> > --
> > Joakim
> >http://www.joakimekberg.se/
>
> > authlogic+...@googlegroups.com<authlogic%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/authlogic?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Authlogic" group.
> > To post to this group, send email to auth...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > authlogic+...@googlegroups.com<authlogic%2Bunsu...@googlegroups.com>
> > .

Gultekin Suleyman

unread,
Dec 7, 2009, 6:30:50 PM12/7/09
to auth...@googlegroups.com

On 5 Dec 2009, at 02:22, Galen wrote:

> Yep, Joakim, the newest patch fixed that bug.
>
> However, now I'm receiving this error:
>
> NoMethodError (undefined method `facebook_session_key=' for #<User:
> 0xba0aaf4>):
> authlogic (2.1.2) lib/authlogic/session/callbacks.rb:72:in
> `validate'
> authlogic (2.1.2) lib/authlogic/session/validation.rb:64:in `valid?'
> authlogic (2.1.2) lib/authlogic/session/existence.rb:65:in `save'
> app/controllers/user_sessions_controller.rb:12:in `create'
>
> Do I need to update by database schema in some way to allow a place to
> save the facebook_session_key?
>
> It seems like this should be a temporary method though...
>
> Cheers,
> Galen


Hi Galen,

I'm new to facebook connect too, but I think you need to add a string column called facebook_session_key to your User model, it should work then.


Tekin Suleyman

Galen

unread,
Dec 8, 2009, 12:51:18 AM12/8/09
to Authlogic
That worked! Thanks!

Adrian Halamoda

unread,
Dec 9, 2009, 7:38:04 AM12/9/09
to Authlogic
Hi, I am also trying to use the plugin with authlogic and have the
same problems

On Nov 19, 8:02 am, Galen <withga...@gmail.com> wrote:
> Turns out 3 of the four behaviors were because I'd placed the
> authlogic_facebook_login_button on a page other than user_sessions =>
> new.

Any solution or explanation for this?
I actually need to have small login form on each page. It works with
authlogic,
but facebook plugin does not.

Facebook login window pops up, but after login there it stays and
shows my site in the login popup,
quite strange. Any ideas what could be wrong? I cant really see any
errors reported or what else could be wrong...

Adrian Halamoda

unread,
Dec 9, 2009, 7:33:06 AM12/9/09
to Authlogic
Hi,

I am also trying to use the facebook plugin with authlogic and have
exactly the same problems.
When I use the facebook button and log myself in the facebook popup,
it doesnt go away, but load my site into the popup.
Any ideas what could be wrong?

On Nov 19, 8:02 am, Galen <withga...@gmail.com> wrote:
> Turns out 3 of the four behaviors were because I'd placed the
> authlogic_facebook_login_button on a page other than user_sessions =>
> new.

Is there any solution for this? I actually have small login form on
each page when user is not logged in,
is it possible for the plugin to support such layout? I would gladly
fix what is needed but I dont really have a clue what could be a
problem...


Galen

unread,
Dec 9, 2009, 4:27:59 PM12/9/09
to Authlogic
I've seen this error before. At the moment I can't track down the
stackoverflow thread that discussed it, but it has to do with the
xd_receiver file being called from a subdirectory (/users/ etc) rather
than the site root.

On Dec 9, 9:33 pm, Adrian Halamoda <adrian.halam...@googlemail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages