mmangino / facebooker2 Goto Github PK
View Code? Open in Web Editor NEWA simple facebook connect library for ruby
License: MIT License
A simple facebook connect library for ruby
License: MIT License
The current_facebook_user in a Tab based isn't really semantically correct. When the Tab is first retrieved, Facebook sent a signed_request (enable OAuth 2.0 in Canvas) with page id as the uid in the request. The data becomes correct once the user start to interact with the Tab.
This cause confusion in the semantic of current_facebook_user and also would be good to support current_facebook_page to provide access to current page for the apps.
What's teh diference between the two? It seems facebook2 only offers authentication functionality? It facebooker still being maintained? Is there "any" documentation or examples for facebooker2 in terms of what can be done beyond fbconect authentication?
Thanks
Hey Mike,
Not sure if this is a Mogli issue or a Facebooker2 issue but it looks like the Mogli::User is not automatically populating when current_facebook_user is called for the first time. After the first request, the Mogli::User instance has all nil attributes except for id.
To get around this we're just invoking current_facebook_user.client.get_and_map(current_facebook_user.id). It also seems to work fine when we do Mogli::User.find(current_facebook_user.id)
I'm guessing Facebooker2 is calling Mogli::User.new (does not merge in results of client.get_and_map) instead of Mogli::User.find (merges in get_and_map).
Hope this is helpful. Keep up the good work, maybe someday we can become contributors :)
Thanks,
Ross
(fb_login_and_redirect(url_for(:controller => :welcome, :action
=>:fblogin, :only_path => false))).html_safe
=> this log me but don't redirect to the appropriate controller....
All output from the helpers is escaped on the page, so it does not render the actual tags, just the text.
I noticed that location and hometown in User
are not getting populated. Actually I don't see any of the hash_populating_accessor
s on the object.
in Model::fetch()
def fetch()
raise ArgumentError.new("You cannot fetch models without a populated id attribute") if id.nil?
other = self.class.find(id,client)
merge!(other) if other
self
end
other
contains the models for location and hometown, but they never get into the user model. merge!
only inserts @_values
. Perhaps it should be done there?
I spent some time looking at it, but Ruby is not my forte, so I wasn't sure the best way to address it.
The "expires" in my facebook cookie is huuuge, out of time's range.
Stack trace:
RangeError (time + 1274313600.000000 out of Time range):
mogli (0.0.7) lib/mogli/client.rb:23:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/facebooker2-0.0.4/lib/facebooker2/rails/controller.rb:27:in `new'
/opt/local/lib/ruby/gems/1.8/gems/facebooker2-0.0.4/lib/facebooker2/rails/controller.rb:27:in `fetch_client_and_user_from_cookie'
/opt/local/lib/ruby/gems/1.8/gems/facebooker2-0.0.4/lib/facebooker2/rails/controller.rb:13:in `current_facebook_user'
Hello and excuse me.
I have the next problem:
In development enviroment facebooker 2 works correctly. However in production enviroment throw a error whose message is
"session is expired"
I was searching in google and i read about offline access, infinite access_token, etc.
So i give perms to facebook app. Then when i connect and redirect to callback url I wrote these lines.
def create_facebook_user
#If current_facebook_user exist: Search the info about facebook_user and then verify if exist a user in my website with
#facebook_user email or id.
if current_facebook_user
@facebook_user = current_facebook_user.fetch
@user = User.fb_user_id_is(current_facebook_user.id.to_i).first
@user = User.login_is(current_facebook_user.email).first if @user.nil?
end
#IF the search was succesful and not exist a user in my db.
if !@facebook_user.nil? && @user.blank?
#create a user
@user = User.new :login => @facebook_user.email, :email => @facebook_user.email, :name => @facebook_user.name
@user.fb_user_id = @facebook_user.id.to_i
@user.state = "active"
@user.access_token = @facebook_user.client.access_token
#A save bug ignore this line
@user.save_with_validation(false)
#save again for the BUG.to ignore duplicate save
if @user.save(:validate=> false)
@user.profile = Profile.create(:real_name => @user.name, :benefactor_id => nil, :benefactor_invites => Setting.find_by_identifier("benefactor_invites").value.to_i)
self.current_user = @user
redirect_to :controller => "profiles", :action => "show", :id => @user.id
else
render "new"
end
#if exist a user in my db but never connect with facebook update his/her fb_id
elsif !@facebook_user.nil? && @user.fb_user_id.nil?
@user.update_attribute :fb_user_id, current_facebook_user.id
self.current_user = @user
redirect_to :controller => "dashboard", :action => "index"
#if exist a user with fb_id => LOGIN
elsif !@facebook_user.nil?
self.current_user = @user
redirect_to :controller => "dashboard", :action => "index"
else
render "new"
end
end
Ok. I create a user and save access_token. however i don´t understand which are the next steps.
In production facebooker throw a error when i try login (in popup)
"Sorry, something went wrong.
We're working on getting this fixed as soon as we can."
Thanks in advance.
The fb_login_and_redirect method depends on update_page helper which was removed on Rails 3.1.
I tried to enable OAuth2 in the facebooker.yml config file and now its not possible to log into the website when clicking the Facebook Connect button.
This javascript error is thrown from a Facebook JS lib
OAuth2 specification states that 'perms' should now be called 'scope'. Please update.
I removed the oauth2 param from the config file and now it works again. Have been getting emails from Facebook that oauth2 needs to be active by 13. December.
Do you know if its a config, facebooker or facebook api problem?
I've started the unpleasant process of conforming my Rails app to work with IE. I'm starting with IE 8, and an error I'm getting is related to an embedded fb_connect_async_js. Windows is complaining that I'm trying to modify the child element before the parent element has closed.
Has anyone experienced this, or can anyone suggest a work around?
Like this:
<%= fb_connect_async_js :en_US %>
or
<%= fb_connect_async_js :ru_RU %>
?
Hi all,
The problem i face here is that after successful authentication, i am getting 'current_facebook_user' value as nil even fetch method results in error
Hi Mike! I'd like to know if it's possitbe to set the option for display parameter as described on this document http://developers.facebook.com/docs/guides/mobile/ can it be declared on the config file? Thanks!
apparently on the id has a value in the current_facebook_user. I'm trying to use email and first and last name to populate a user record, and they are both empty, as is first_name, last_name.
Accessed in application.rb as
user = User.new(:email => current_facebook_user.email,
:first_name => current_facebook_user.first_name,
:last_name => current_facebook_user.last_name,
:alias => "#{current_facebook_user.first_name} #{current_facebook_user.last_name}",
:facebook_id => current_facebook_user.id)
after confirming that current_facebook_user exists.
I took a quick look through the code to try and find a timeout option, but couldn't find one (although httparty does). Did I miss something?
The file /lib/facebooker2/rails/controller.rb requires ruby-debug, but that gem is not a dependency of the facebooker2 plugin, causing issues on systems without ruby-debug.
some issues getting this to play nice. Now that I have the plugin facebooker2 installed, migrations dies looking for mogli :
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- mogli
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
require'
I've tried installing and uninstalling the mogli gem, and no luck. What's going on here?
Facebook says the Graph API is not very complete: does that affect Facebooker2 not be able to support: Like button, Share button, and the Log in with Facebook?
http://developers.facebook.com/docs/reference/rest/
Note: We are currently in the process upgrading our core server API from the old REST API to the more modern Graph API. Most of the methods required for canvas applications to integrate with Facebook have not yet been upgraded to the new API. For the time being, we recommend you continue using the old REST API in canvas apps instead of the new APIs for the sake of completeness.
If a project is running Rails 2.2.2, and it uses controller.helper
and the helper
is not defined, then how can it be solved? (this is for the Facebooker2 gem http://github.com/mmangino/facebooker2)
details:
error shown:
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
Exiting
/Library/
Ruby/
Gems/1.8/gems/facebooker2-0.0.5/lib/facebooker2/rails/controller.rb:8:
in `included': undefined method `helper' for Object:Class (NoMethodError)
The code is: error line is line 8:
controller.helper Facebooker2::Rails::Helpers
in the following code:
module Facebooker2
module Rails
module Controller
def self.included(controller)
controller.helper Facebooker2::Rails::Helpers
controller.helper_method :current_facebook_user
controller.helper_method :current_facebook_client
controller.helper_method :facebook_params
end
if that line is changed to controller.helper_method
like the line below it, it'd say helper_method
not found too.
i need to log the user out of my app when that person logs out of his facebook account, i don't seem to find a way to discover this?
I tried to use current_facebook_user but it is never set to nil. I tried to use current_facebook_user.fetch and it seems to throw an exception if the user logs out - but its erratic. Does not behave like that all the time for all users.
what is the correct way to discover if the user is still logged in facebook or not?
I am trying to use something like
= fb_connect_async_js { concat "alert('hello');" }
in my application layout haml, which outputs the coe fine, but renders my entire page twice. Any idea why this would happen?
Now that I have a proper Facebooker test app, it's easier to point out bugs. With IE8, follow these steps :
1- Go to http://apps.facebook.com/facebooker-test/
2- Authorize the app
You should get caught in an endless redirect loop between the Facebook authorization page and the canvas page. It's as if the signed_request
returned by Facebook doesn't contain a logged in user.
The workaround I coded is to use the code
param sent by Facebook in the request to login the user with mogli. It looks like this :
def fetch_client_and_user_from_code
if params[:code]
client = Mogli::Client.create_from_code_and_authenticator(params[:code],
Mogli::Authenticator.new(Facebooker2.app_id, Facebooker2.secret, nil))
fb_sign_in_user_and_client("me", client)
end
rescue
nil
end
If others can reproduce this bug, I can submit a pull request.
I am trying to follow the tutorial here at http://www.seanshillo.com/content/setting-ssh-tunnel-rails-facebook-app, to set up a ssh tunnel. I installed the plugin and the mogli gem but I don't see any rake tasks like facebooker:tunnel:start. Am I missing something?
Can Facebooker2 give some info on the API? For example, with the code in README, after Facebook signs a user in, what is the API to do what was in Facebooker 1's
rescue_from Facebooker::Session::SessionExpired do |exception|
and
self.email_hash = Facebooker::User.hash_email(email)
I think whenever we call current_facebook_user()
or current_facebook_client()
, then it will verify that the user is indeed the logged in user (checking the cookies), and we can use whatever in our DB to store this Facebook user's login name ... such as _app123456_user_678678678
as the login name (login id).
I have just updated to latest Facebooker2 version and got this error when i am trying to use current_facebook_user, i have made some inspection and went down to discover what is going wrong. So here is what i've discovered:
def Base.digest(key, text)
begin
hmac = self.new(key)
hmac.update(text)
hmac.digest
ensure
hmac.reset_key
end
end
hmac is nil in ensure because it is never set
and if i go to see what new method does is use set_key(key) in the same class which is doing xor operation on Facebook secret key. So if I try to test this new instance in console and send over Facebook secret key i get this error message
NoMethodError: undefined method ^' for "6":String from /Users/ivanturkovic/.rvm/gems/ruby-1.9.2-p290@spda/gems/ruby-hmac-0.3.2/lib/hmac.rb:49:in
block in set_key'
from /Users/ivanturkovic/.rvm/gems/ruby-1.9.2-p290@spda/gems/ruby-hmac-0.3.2/lib/hmac.rb:48:in each' from /Users/ivanturkovic/.rvm/gems/ruby-1.9.2-p290@spda/gems/ruby-hmac-0.3.2/lib/hmac.rb:48:in
set_key'
from /Users/ivanturkovic/.rvm/gems/ruby-1.9.2-p290@spda/gems/ruby-hmac-0.3.2/lib/hmac.rb:30:in initialize' from /Users/ivanturkovic/.rvm/gems/ruby-1.9.2-p290@spda/gems/ruby-hmac-0.3.2/lib/hmac-sha2.rb:7:in
initialize'
from (irb):12:in `new'
It seems that Facebook secret key is being used xor operation on a string which makes hmac nil and raises an exception so when it is in ensure block the hmac is still nil.
Did you came with this problem before?
Looks like the fb connect URL showing up in the popup window after clicking the fb connect log in button is not passing all the correct params?
I see;
I'm guessing that at least api key ought to reflect what's active in facebooker.yml for api_key rather than app_id, and I don't imagine that client_id should also be being passed in from the app_id?
Anyone have any ideas on this one?
Regards
Eric
Hi,
I have before_filter in my application_controller like this:
before_filter :set_current_facebook_user
def set_current_facebook_user
@current_facebook_user = current_facebook_user
end
but sometimes I recieve this error "Errno::ETIMEDOUT: Connection timed out - connect(2)". Here is my backtrace:
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:560:in `initialize'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:560:in `open'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/timeout.rb:53:in `timeout'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/timeout.rb:101:in `timeout'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:553:in `do_start'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:542:in `start'
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:1035:in `request'
/home/cheetah/gems/ruby/1.8/gems/httparty-0.8.1/lib/httparty/request.rb:73:in `perform'
/home/cheetah/gems/ruby/1.8/gems/httparty-0.8.1/lib/httparty.rb:391:in `perform_request'
/home/cheetah/gems/ruby/1.8/gems/httparty-0.8.1/lib/httparty.rb:343:in `get'
/home/cheetah/gems/ruby/1.8/bundler/gems/mogli-2be6922b2403/lib/mogli/client.rb:50:in `create_from_code_and_authenticator'
/home/cheetah/gems/ruby/1.8/bundler/gems/facebooker2-172665891037/lib/facebooker2/rails/controller.rb:231:in `oauth2_fetch_client_and_user_from_cookie'
/home/cheetah/gems/ruby/1.8/bundler/gems/facebooker2-172665891037/lib/facebooker2/rails/controller.rb:221:in `oauth2_fetch_client_and_user'
/home/cheetah/gems/ruby/1.8/bundler/gems/facebooker2-172665891037/lib/facebooker2/rails/controller.rb:16:in `current_facebook_user'
/data/c/cheetah/planet_of_winners/releases/20111115100155/app/controllers/application_controller.rb:118:in `set_current_facebook_user'
Before I recieve this error, I have to wait about 45 seconds to finish my action and then I recieve this timeout error.
Does anybody know, how to solve this problem? Thanks a lot.
Martin
Is there a way to tell the Facebook API to return profile-pics over https if the page you are serving from is https?
I keep on getting different mixed content warnings on Chrome and Firefox and in IE8 the page seems to hang on loading the http profile images and the images do not show up.
After a lot of searching I found this:
http://stackoverflow.com/questions/2519166/security-warnings-in-facebook-connect
Which talks about "return_ssl_resources" which is what I want but not sure where I integrate this with Facebooker2 and the fbml parse.
Any ideas?
I've seen that some recent commits have been merged to "master" regarding OAuth 2.0 support for mogli and facebooker2.
I need to make the authentication migration to OAuth 2 for the app I am working on (currently using facebooker2 with OAuth 1) since Facebook will go full OAuth 2 on October 1st.
There is yet no information on this, but I setted up "Facebooker2.oauth2 = true" in config/initializers/facebooker2.rb to activate the thing and activated the OAuth Migration in my facebook settings App. Keeping the same flow as before, when I try to log in my app with facebook, I have a current_facebook_user to nil. What did I forget? Is the OAuth 2 support fully applied?
Thx
I upgraded Facebooker2 to gem version 0.0.10. The skeleton app I created for cookie bug (https://github.com/zakmandhro/facebooker2_cookie_bug) now works in Chrome, Firefox and Safari, but fails in Internet Explorer 7 and 8.
Here are some of the issues I noticed right a way:
current_facebook_user
returns true even after logging out of Facebook - seems like cookie is not removed when it should be.fb_connect_async_js
uses true
for channel URL - which is invalid according to Facebook.fb_login_and_redirect
doesn't open Facebook login windowfb_logout_link
doesn't seem to do anythingI am not sure if this related to my virtualized environment. Anyone using 0.0.10 tested in IE 7 and 8?
If I following everything on the README, and print out
"Welcome #{current_facebook_user.first_name} ... "
it is empty... if I print current_facebook_user.first_name
, it is nil
, and so is current_facebook_user.email
or current_facebook_user.birthday
, even though when logging in, Facebook asked for permission for email and birthday and I clicked "Allow", they all print out as nil
. Do you know a reason why that is?
(the fb_name(current_facebook_user, :useyou => false)
is working though, but it is done by the Facebook Javascript SDK instead of the server side)
I'm finding that current_facebook_user and current_facebook_client are sometimes returning nil for no apparent reason. It seems to work in other cases. To work around the problem I had to write the following function, and include this as a before_filter in my application controller:
def obtain_facebook_user
# This is a fix to Facebooker2 in case it is returning nil for client/user.
unless @_current_facebook_client
@_current_facebook_client = Mogli::Client.new(current_user.facebook_access_token)
end
unless @_current_facebook_user
@_current_facebook_user = Mogli::User.find("me",@_current_facebook_client)
end
end
This succeeds in setting the client and user variables that Facebooker2 wants to have, but I'm a bit unfomfortable with it since it seems like it could be slow if invoked for every page--and I'm mystified by why the client/user aren't being set in the first place.
Any thoughts on what might cause the situation I've described?
I installed mogil, put it in config.gem. INstalled facebooker asa a plugin.
Now when I start the console or any ruby process I get an error..
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- hmac-sha2 (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in
new_constants_in'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /home/username/Apps/myapp/vendor/plugins/facebooker2/lib/facebooker2/rails/controller.rb:2 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in
require'
from /home/username/Apps/myapp/vendor/plugins/facebooker2/lib/facebooker2.rb:45
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in load_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:380:in
load_file'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:379:in
load_file'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:259:in require_or_load' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in
load_missing_constant'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in
const_missing'
from /home/username/Apps/myapp/config/initializers/facebooker2.rb:1
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in load_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
load'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in
load'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in load_application_initializers' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in
each'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in load_application_initializers' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:176:in
process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in send' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in
run'
from /home/username/Apps/myapp/config/environment.rb:10
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
from /usr/local/lib/ruby/1.8/irb/init.rb:254:in load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:252:in
each'
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in load_modules' from /usr/local/lib/ruby/1.8/irb/init.rb:21:in
setup'
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/local/bin/irb:13
Hi,
you have dependency in your actual revision of mogli gem 0.0.33. If I use you version of this gem https://github.com/mmangino/mogli, I'll se version 0.0.31.
So my question is, which branch of mogli is suitable for your facebooker2 gem?
Thanks a lot,
Martin P.
I'm a bit of a rails noob, but as I'm getting an issue where my layout renders twice.
<%- fb_login :text=>"mytext" do%>
alert('test')
<%end%>
Using code renders two login buttons.
It seems like a bug to me or am I doing something wrong?
I have implemented Facebooker2 on my project and it works perfectly on my development server as well on a local production server. After deploying the project to Amazon EC2 using Rubber, the application fails when trying to connect with facebook. I am getting this error: NoMethodError (undefined method `fetch' for nil:NilClass):
which occurs when I am trying to fetch the current_facebook_user information. Its seems as if the current_facebook_user is not populated with the returned values from Facebook and that it is remaining nil. Again it is working perfectly on dev env and local production env.
Am I missing something? Please help.
Hi,
I'm new to Ruby and to Rails, but trying to figure things out as I develop.
I've got the code as below. I'm not able to figure out why current_facebook_user is always nil. I've looked at the facebooker2_fb_connect_example and even got it running in Heroku. Yet, when I run this app, I'm never able to connect.
sessions/new.html.erb:
<%= fb_login_and_redirect fblogin_path, :perms => 'email,user_location,publish_stream' %>
SessionsController:
def create_from_fb #fblogin route
# current_facebook_user.fetch # throws exception, current_facebook_user is nil
if current_facebook_user # never true
@fb_id = current_facebook_user.id
current_facebook_user.fetch
@fb_email = current_facebook_user.email
@fb_name = current_facebook_user.first_name
end
end
sessions/create_from_fb.html.erb (only HTML shows up, no values from the result):
Id: <%= @fb_id %>
Email: <%= @fb_email %>
Name: <%= @fb_name %>
<% if current_facebook_user %>
Thanks
Is it true that we install it as a plugin first by
script/plugin install git://github.com/mmangino/facebooker2.git
and then since it depends on mogli, so also do it by
script/plugin install git://github.com/mmangino/mogli.git
What if in some cases, we want to install it as a plugin, but installing the one on rubygems.org which is installed by
gem install -v ____ facebooker2
is it true that in Rails 3, then we just use Bundler and add to Gemfile
gem 'facebooker2'
and bundle install
will do the rest?
If it is Rails 2, then can we also use
gem install facebooker2
gem install mogli
rake gems:freeze GEM=facebooker2
rake gems:freeze GEM=mogli
to freeze the gems into the vendor
directory?
Thanks.
I'm trying to use this in rails3 app. But its taking way longer coz of missing dependent gems and not bundler ready coz bundle install doesn't installs the dependencies.
RIght now its two gems I'd to bundle after each failure,
mongli
ruby-mac
Ain't there any fork compatible with rails 3?
When I add the line
Facebooker2.load_facebooker_yaml
to my facebooker2.rb initializer file, the app crashes.
file is at /config/facebooker.yml
It's a standard yml, with 3 values, pasted from your README and the values for app_id, secret and api_key. I have not quoted these in the yml file – is this a problem?
maybe i should post that in the mogli repository but I'm using facebooker2 with it.
Since I upgrade to rails 3.0.9 or 3.0.10 with ruby1.9.2p290 I cannot display the facebook post comments anymore
<% current_facebook_user.home.each do |post| %>
<% post.comments.each do |comment| %>
<%= comment. message %>
<% end %>
<% end %>
I got the same error when I ask for comments inside current_facebook_user.feed too
I used facebooker2 0.0.11 and mogli 0.0.29
If some have any suggestion to help me, it will be realy appreciated
I have updated the gem to facebooker2 0.0.11 but i'm still unable to complete the connection with IE9
Invalid Argument
Given Url is not allowed by the appllication configuration
with IE7-8 the connect button don't apear
It work in FF-CHROME-SAFARI
I tried with a minimal permission without success
what i'm doing wrong?
This should be solved by commit 1726658 but it seems is not:
Issuing a Facebooker2.oauth2
on the rails console returns false (with facebooker2 (0.0.14)) when oauth setting is NOT set in facebooker.yml, so it seems that it doesn't really defaults to oauth2.
It's possible that this code in self.configuration=(hash) of facebooker2.rb overwrites the oauth2 variable when it's NOT set in the config file?
self.oauth2 = hash[:oauth2].blank? ? false : true
Ignore
I am passing perms for email correctly, and the plugin tests well for facebook users who have only one email address. However, for users with multiple email addresses listed under their settings in Facebook, the facebook_session.user.email comes back as nil.
Is this because facebook is sending back nil, or could it be that it is sending an array (or some other data type), while the plugin is expecting a string?
Any help will be greatly appreciated. Thanks!
In general, if an app is using facebooker
already (for "Log in with Facebook", and the "Share" button), and then if wanting to also use the Facebook Javascript SDK
( http://developers.facebook.com/docs/reference/javascript/ ) for a "Like" button, then the two will conflict with each other? So as a result, we really need to upgrade everything to facebooker2
, and change all the old code to use facebooker2
? Thanks.
In Rails 3, if a controller does redirect_to, the Facebooker2::Rails::Controller#set_fb_cookie
sets fbs_[APP_ID]
cookie to deleted
. To reproduce:
ApplicationController
include#{current_user}
redirect_to
to the view that renders current_userI commented out the line that sets the cookie to 'deleted' and everything seems to work fine - including login, logout, redirect and refresh.
#cookies[fb_cookie_name] = { :value=>value }#, :expires=>expires}
What am I missing?
Hi, Mike:
Could you please help clarify an issue for me -- I think that the answer to the following is "No", but wanted to check with you, just in case.
etc.
Does this apply to people who use Facebooker2 and Mogli? If so, could you please tell me what we would need to change?
Thanks a lot.
--Alex
Again with IE8! Follow these steps :
1- Once the app is authorized (and authorization won't work with IE), go to : http://apps.facebook.com/facebooker-test/
2- Click on the call FB.getLoginStatus link.
You should get an alert message but you won't. IE does not like how the JS SDK is loaded with Facebooker2.
To fix this, we have to create the root div as an html element (instead of creating with JS) like stated on FB SDK page : http://developers.facebook.com/docs/reference/javascript/
If others (Mike?) can reproduce the bug, I will submit a pull request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.