grimen / devise_facebook_connectable Goto Github PK
View Code? Open in Web Editor NEWDevise << Facebook Connect. IMPORTANT: Not maintained anymore.
License: MIT License
Devise << Facebook Connect. IMPORTANT: Not maintained anymore.
License: MIT License
...if used together with authenticatable module.
The problem is actually in facebook_connect_form helper.
scope = ::Devise::Mapping.find_by_path(request.path).to rescue scope
Devise::Mapping.find_by_path(arg).to return a class i.e. User. When form_for(scope) is called later, it actually calls form_for(User) and Rails tries to call dom_id method on User, which in turn calls #id method. In Ruby 1.8 it raises just a warning, but in 1.9 this method is missing.
I'm not sure why this form is needed inside facebook_sign_in_link at all, but switching from #to to #name method in the line mentioned above fixes the problem.
hi guys,
i installed devise on devise_facebook_connectable plugin. But command traced output
rails generate devise_facebook_connectable --api API_KEY --secret SECRET_KEY
/Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/facebooker-1.0.75/lib/facebooker/adapters/adapter_base.rb:6:in `<class:AdapterBase>': uninitialized constant ActiveSupport::CoreExtensions (NameError)
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/facebooker-1.0.75/lib/facebooker/adapters/adapter_base.rb:3:in `<module:Facebooker>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/facebooker-1.0.75/lib/facebooker/adapters/adapter_base.rb:1:in `<top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/facebooker-1.0.75/lib/facebooker.rb:259:in `<top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/devise_facebook_connectable-0.2.2/lib/devise_facebook_connectable.rb:3:in `<top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
from /Users/halid/RubymineProjects/kh-network_v2/config/application.rb:7:in `<top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /Users/halid/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'mysql2'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise'
gem 'devise_invitable'
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"
gem "settingslogic"
gem 'devise_security_extension'
gem 'devise_facebook_connectable'
gem 'facebooker'
gem 'rails_email_validator'
gem 'devise-basecamper'
gem 'devise-twitter'
gem 'activesupport'
environment.rb
config.gem 'devise_facebook_connectable'
config.gem 'devise'
config.gem 'facebooker'
I wonder where the error am I doing?
Thanks,
...seems to be overridden or not loaded. Not sure why.
Im trying to integrate devise_facebook_connect into my site, however my users model is named Usuario. Im using the following helper tag:
<%= facebook_sign_out_link :usuario %>
Which throws:
undefined method `destroy_user_session_path' for #ActionView::Base:0x9722a00
I think the offending line is view_helpers.rb:98
Hi-
Signing out doesn't work with the latest -v of facebooker: the 'signing-out' pop-up comes up, and on page-reload, a message flashed that the user is signed out, but the user is still signed-in in the corner (e.g. there's still a facebook signout link). Is the user getting autologged back in to fb somehow? I reverted back to 1.0.74 for the time being.
I'm running the new ruby1.9.2-p0 on WinXP with Rails 2.3.8.
Only appears in HAML:
/Users/grimen/Development/examples/devise_plugin/devise_example/vendor/plugins/devise_facebook_connectable/lib/devise_facebook_connectable/view_helpers.rb:79:in `facebook_login_or_connect_link' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/capture_helper.rb:39:in `call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/capture_helper.rb:39:in `capture_without_haml' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/capture_helper.rb:129:in `with_output_buffer' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/capture_helper.rb:39:in `capture_without_haml' /Library/Ruby/Gems/1.8/gems/haml-2.2.8/lib/haml/helpers/action_view_mods.rb:88:in `capture' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/tag_helper.rb:70:in `content_tag_without_haml' /Library/Ruby/Gems/1.8/gems/haml-2.2.8/lib/haml/helpers/action_view_mods.rb:98:in `content_tag' /Users/grimen/Development/examples/devise_plugin/devise_example/app/views/home/index.html.erb:3:in `_run_erb_app47views47home47index46html46erb' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in `send'
I looked through all issues but didn't find anyone else having this problem. I'm trying to get devise_facebook_connectable working with the most recent versions (as well as a facebooker fork which will work in rails 3: http://github.com/joren/facebooker ).
I sent you a pull request for http://github.com/funkensturm/devise_facebook_connectable/commit/067b10c760eb088b44c61b209caa371912b32b6a to continue trying to make this run :)
...so that regular accounts can become Facebook Connected too without creating a new account. Requires that Facebook (API) recognizes the specified e-mail.
using:
devise (0.7.1) (ORM: mongo_mapper)
devise_facebook_connectable (0.1.5)
class User
devise :authenticatable, :facebook_connectable
end
Looks like a re-emergence of a closed bug, looks like devise changed some mappings which were monkey patched.
Every time when you try to do something like this
current_user.facebook_session.user.populate(*fields)
current_user.facebook_session.user.name
you receive the following exception - Facebooker::Session::SessionExpired!
Can this line in authenticate!
user.save_with_validation(false)
be replaced with:
user.save(false)
ActionView::TemplateError (undefined method `user_session_path' for #ActionView::Base:0x10360c828)
...seems to be raised quite often. Not really sure why now, but looking into it.
Not really an issue, but how can I edit User records when the user is a Facebook only user. The situation is that I have added several fields to my User model for "profile" data. I can edit the Devise forms to add these fields but Devise requires a password to authorize the user to Update the profile. For Facebook Users there is no password. I created a new controller and view for FB users but the system still rejects the Update, probably because there is no password authorization for Updates.
Timeoutable module (Devise core) should timeout Facebook sessions as well.
can facebook_link detect the presence of fb session on a user, and then just display the standard logout link, if the user did not sign in with facebook?
I've just integrated devise_facebook_connect with my site and saw a very strange behavior. When i login via facebook connect some data is held around (not sure what yet) and if i go to a new browser on a new machine, it will auto log me in as the last user to log into my site, without any credentials or anything. This also manifests itself on the original browser if i try to log out, which does log me out of facebook and clears the facebooker session and tells me i have successfully logged out, but will then auto log me in as the last user to log into the site. Even if i clear my browser cookies and return to the site, it again logs me in as the last user to hit the site. Note this does not happen with standard devise accounts, those still work on my site just fine and i can log in/out of them without trouble.
Now i couldn't reproduce this in my development environment (mongrel) but in production i'm using nginx+passenger (on EngineYard). When i then switched production to nginx+mongrel everything works fine.
Has anyone else seen this? or by chance is there a bug in devise_facebook_connectable that it is storing some data somewhere that passenger is holding onto but that mongrel does not?
I'm not sure if this belongs to devise_facebook_connectable or if it is a problem of my coding but I think i mention it here. I followed the guide here to set up facebook connect and it works wonderful, the tutorial is great.
After I did a db:reset, logging in with facebook is not working anymore with my facebook account. I tried deleting the app relation ("allow this app to ... with your account?") in my facebook account, but this also hadn't helped. Every time i press the "connect with facebook" button, i get redirected to my default login page for users w/o facebook. This is because the requested user isn't found locally.
Processing SessionsController#create (for 127.0.0.1 at 2010-08-03 15:09:10) [POST]
Parameters: {"action"=>"create", "authenticity_token"=>"0df/gzXCuKZMIdYwZpbF57ciC0fz+9Lj4zn83HZ6+m4=", "controller"=>"sessions"}
User Columns (4.2ms) SHOW FIELDS FROM users
User Load (14.0ms) SELECT * FROM users
WHERE (users
.facebook_uid
= 1217347545) LIMIT 1
Rendering template within layouts/application
Rendering sessions/new
Rendered shared/_devise_links (18.8ms)
Completed in 257ms (View: 119, DB: 19) | 200 OK [http://localhost/users/sign_in]
I think it would be good if someone could also cover this in the docs. If someone can point me to a solution, I would write the docs update. But I currently don't understand everything that's going on here with devise and fb connect things, so I would appreciate a little bit help ;-)
here is my call back, tried a before_fb_connect but still nothing is set. will try and build a bare bones app to demonstrate the prob.
def after_facebook_connect(fb_session)
# Just fetch what we really need from Facebook...
fb_session.user.populate(:locale, :current_location, :username, :name,
:first_name, :last_name, :birthday_date, :sex,
:city, :state, :country, :relationship_status, :proxied_email)
self.birthdate = fb_session.user.birthday_date.try(:to_date)
self.city = fb_session.user.hometown_location.try(:city)
self.country = fb_session.user.hometown_location.try(:country)
self.first_name = fb_session.user.first_name
self.gender = fb_session.user.sex
self.last_name = fb_session.user.last_name
self.locale = fb_session.user.locale
self.real_name = fb_session.user.name
self.relationship_status = fb_session.user.relationship_status
self.time_zone = fb_session.user.current_location.try(:city)
self.username = fb_session.user.username
self.zip_code = fb_session.user.hometown_location.try(:state)
self.proxied_email = fb_session.user.proxied_email
self.save
end
I've got an admin model and an user model, the admin model does not have devise :facebook_connectable
, but the user does. However when I try and login as an admin it fails with Admin undefined method facebook_connect (and the other FacebookConnectable class methods).
I'm having trouble converting an existing project over to haml.
After adding the haml gem to my environment.rb and converting all my erb files to haml per the README caveat (Re HAML clashing with ERB) I'm now getting the following issue on any pages with a facebook_sign_(in||out)_link call.
NoMethodError in Home#index
Showing app/views/layouts/application.html.haml where line #19 raised:
undefined method `<<' for #Haml::Helpers::ErrorReturn:0xb63fbc98
Extracted source (around line #19):
16: .fb_card_info
17: - if current_user_admin?
18: = link_to 'A', admin_path, :class => 'sign_out', :style => 'float: right;'
19: = facebook_sign_out_link :user, :v => '2', :size => :small
20: %span= current_user.name
21: - else
22: = facebook_sign_in_link :user, :v => '2', :size => :small
If you know what might be causing this, or if I need to do anything beyond simply removing all ERB files from my project, please let me know.
Something weird is going on, with fb login. Having removed all my cookies and signed out of both the app and fb, I sometimes get signed in automatically without clicking the fb connect button as a user (and when I try and sign out - I get signed in again as an admin o.0
).
This occurs across many browsers and different computers (all with cookies cleared) - the only thing that i can think of is it might be an issue with all machines having the same IP address, or a bug with FB connect, or a bug in devise/fb_connectable/facebooker.
I will try upgrading to master and report back
There is no longer an 'authenticatable(routes, mapping)' method.
It is now 'devise_session(mapping, controllers)' and the alias in routes.rb blowed up.
I think it maybe be because I've upgraded devise to trunk (i'll try and roll back and see what happens, but just letting you know it throws an error)
/Users/matt/.gem/ruby/1.8/gems/devise_facebook_connectable-0.1.8/lib/devise_facebook_connectable/strategy.rb:14:in `include': wrong argument type Class (expected Module) (TypeError)
from /Users/matt/.gem/ruby/1.8/gems/devise_facebook_connectable-0.1.8/lib/devise_facebook_connectable/strategy.rb:14
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /Users/matt/.gem/ruby/1.8/gems/devise_facebook_connectable-0.1.8/lib/devise_facebook_connectable/model.rb:4
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /Users/matt/.gem/ruby/1.8/gems/devise_facebook_connectable-0.1.8/lib/devise_facebook_connectable.rb:16
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /Users/matt/dev/bz/coupon/config/environment.rb:9
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./script/server:3
Hi,
I've spent a day but now i give up. Fallowing the instruction i was able to add the fconnect button in no time, but I'm not able to fetch data from the user logged in.
I tried to override the method in my User model, but Rails seem to do not see it :) . I'm using Rails 2.3.8. If anyone can help me it would be so great!
Thanks for your attention
When I set callback_url under facebook.yml, in the development section...
development:
<<: *defaults
callback_url: http://mydevserver:3000
...that hostname is prepended to all my CSS and JS includes!
devise_facebook_connectable 0.2.2, rails 2.3.8.
Making it straightforward to disconnect an account Facebook Connect style: Deleting the account at the same time.
Hey, sorry for the dumb question but what is the use case for this?
Can I put a facebook connect link on the sign up page and users can use it to log on to my site? (creating a record for them in my database). Or do they need an account for my site that they can then link to facebook?
Thanks!
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.