Skip to content
emp29 edited this page Sep 13, 2010 · 10 revisions

I hope someone updates this wiki and writes more documentation about using this plugin.
h2. How-to

Using jQuery with authlogic_facebook_connect

If you are using jQuery rather than Prototype make the following modifications:

<%= init_fb_connect "XFBML", :js => :jquery %>

and

<%= authlogic_facebook_login_button :js => :jquery %>

Testing FB Connect in a dev environment

Getting this to work on a local dev environment was an annoyance for me. Here’s what I ended up doing.

  • Created an entry in my hosts file (/etc/hosts) that pointed dev.mydomain.com to my.routers.public.ip
  • Logged into my router, port forwarded 3000 > MyDevMachine port 3000
  • In config/facebooker.yml set:
callback_url: http://dev.mydomain.com:3000
set_asset_host_to_callback_url: false
  • Verified I could access my application via dev.mydomain.com:3000
  • On Facebook.com, under my Applications’s Connect settings, set Connect Url: http://dev.mydomain.com:3000/

Troubleshooting

No route matches “/user_session” with {:method=>:post, :canvas=>false}

This occurs because when setting up autologic, you most likely added a UserSessionsController (note UserSessions is plural). By default, authlogic_facebook_connect uses the singular name for this controller (UserSession). You can override the controller by passing a :controller => ‘value’ hash, like so:

<%= authlogic_facebook_login_button :controller => ‘user_sessions’ %>

Undefined method `facebook_session_key=’ for #

Add a string column to the users table named ‘facebook_session_key’

Example migration:

class AddFacebookSessionKeyToUsers < ActiveRecord::Migration
  def self.up
    add_column :users, :facebook_session_key, :string
  end
  def self.down
    remove_column :users, :facebook_session_key
  end
end 

Other

Facebook_session.user attributes

I spent a while trying to dig up a list of facebook user attributes I could pull down and through i’d share the list:

facebook_session.user.status 
facebook_session.user.political 
facebook_session.user.pic_small 
facebook_session.user.name
facebook_session.user.quotes 
facebook_session.user.is_app_user 
facebook_session.user.tv 
facebook_session.user.profile_update_time 
facebook_session.user.meeting_sex 
facebook_session.user.hs_info 
facebook_session.user.timezone 
facebook_session.user.relationship_status 
facebook_session.user.hometown_location 
facebook_session.user.about_me 
facebook_session.user.wall_count 
facebook_session.user.significant_other_id 
facebook_session.user.pic_big 
facebook_session.user.music 
facebook_session.user.work_history 
facebook_session.user.sex 
facebook_session.user.religion 
facebook_session.user.notes_count 
facebook_session.user.activities 
facebook_session.user.pic_square 
facebook_session.user.movies 
facebook_session.user.has_added_app 
facebook_session.user.education_history 
facebook_session.user.birthday 
facebook_session.user.birthday_date 
facebook_session.user.first_name 
facebook_session.user.meeting_for 
facebook_session.user.last_name 
facebook_session.user.interests 
facebook_session.user.current_location 
facebook_session.user.pic 
facebook_session.user.books 
facebook_session.user.affiliations 
facebook_session.user.locale 
facebook_session.user.profile_url 
facebook_session.user.proxied_email 
facebook_session.user.email_hashes 
facebook_session.user.allowed_restrictions 
facebook_session.user.pic_with_logo 
facebook_session.user.pic_big_with_logo 
facebook_session.user.pic_small_with_logo 
facebook_session.user.pic_square_with_logo 
facebook_session.user.online_presence 
facebook_session.user.verified 
facebook_session.user.profile_blurb 
facebook_session.user.username 
facebook_session.user.website 
facebook_session.user.is_blocked 
facebook_session.user.family
facebook_session.user.uid  facebook_session.user.name 
facebook_session.user.timezone 
facebook_session.user.birthday 
facebook_session.user.sex 
facebook_session.user.affiliations 
facebook_session.user.locale 
facebook_session.user.profile_url 
facebook_session.user.proxied_email