开发者

Authlogic Facebook find existing account

开发者 https://www.devze.com 2023-01-01 13:18 出处:网络
Using Authlogic and Authlogic Facebook Connect. before_filter works great.Get name and facbook_uid saved in db.Only problem is that it saves a new record every time.

Using Authlogic and Authlogic Facebook Connect.

before_filter works great. Get name and facbook_uid saved in db. Only problem is that it saves a new record every time.

Need help figuring out how to build some type of find_by_facebook_uid_or_create_user

I have tried reading up on the API's for facebooker, but this is way over me. :(

UPDATED -

user.rb

def before_connect(facebook_session)
   self.firstname 开发者_开发问答= facebook_session.user.first_name
   self.lastname = facebook_session.user.last_name
   self.persistence_token = reset_persistence_token
end

application_controller.rb

before_filter :set_facebook_session
helper_method :facebook_session


For those that are having the problem that a new user is created every time they f-connect and are using MySql, change the facebook_uid from Int (integer) to BigInit (Big Integer).

Problem for me was that facebook was looking at long ID's and Int was truncating these ID's.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号