Giter Site home page Giter Site logo

authlogic-facebook-connect's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

authlogic-facebook-connect's Issues

Placement of authlogic_facebook_login_button

If one places <%= authlogic_facebook_login_button %> inside the form_for, things will almost work but not quite.

If it's easy to do, it would be nice if it worked one way or another.

Otherwise it might be worth specifying more precisely where to put the authlogic_facebook_login_button in the instructions.

Thanks!

First Attempt Does Not Redirect

When a new user clicks the Facebook login button, the popup shows. But after pressing "allow" the user is not redirected to the dashboard page. However, after this, if the user refreshes the login page and clicks the Facebook login button again, he is immediately taken to the dashboard (the url bar shows that it first goes to /user_session for authentication - and there is no popup because the application is allowed.)

Make authlogic_facebook_login_button library independent

The authlogic_facebook_login_button method accepts a "js" option which supports prototype, and jquery libraries. The JavaScript part of this function simply gets an element by id, and calls the submit method on it. It will be nice to make it library independent by simply replacing various library specific implementations such as:

$('connect_to_facebook_form')
jQuery('#connect_to_facebook_form')

with

document.getElementById('connect_to_facebook_form')

The above method is cross-browser and works on all browsers as fari as I know. We wouldn't have to keep adding support for each individual library with this change. The file that the change would need to go in is authlogic_facebook_connect/helper.rb

create custom buttons?

is it possible to pass the authlogic helper a string that it will render as a link? such as with the facebook api: <fb:login-button v="2">fb:intlMy custom text here/fb:intl/fb:login-button

can this be achieved with authlogic facebook connect?

thanks,
plc

SystemStackError (stack level too deep)

At first, I don't know where you resolve in normal cases. But I found this bug when I logged to site with facebook_connect and then recreate database. So I found exception. I dive deeper to your library and found that you have infinity callback calling in line:

validate :validate_by_facebook_connect, :if => :authenticating_with_facebook_connect?

and you call save in validate_by_facebook_connect, so it recursivly call itself. I fix it by this code:

 def validate_by_facebook_connect
    facebook_session = controller.facebook_session
    self.attempted_record = facebook_user_class.find(:first, :conditions => { facebook_uid_field => facebook_session.user.uid })

    if self.attempted_record
      self.attempted_record.update_attribute(facebook_session_key_field, facebook_session.session_key)
    end

Please add fix in new version

Nothing is saved to the local model

Hi Joakim -

I added this to the session.rb file (line 75)

        Facebooker::User::STANDARD_FIELDS.each do |f|
          if new_user.respond_to?(f)
            new_user[f] = facebook_session.user.send(f)
          end
        end

If the user model has fields with the same names, e.g. first_name it will populate the record when it creates it.

Error when request login with extend permissions

Hi everyone,
I'm encountering a curious bug since a week or so now.

This example: big-glow-mama.heroku.com has exactly the same issue as me.

In order to get logged in you have to click the login button, click allow, then the website is rendered inside of the popup without logging you in, you then have to close the popup, refresh the website and hit loggin button again.

The url of the page in the popup looks like this
[http://dev.local.com/?perms=email%2Cuser_birthday%2Cuser_location%2Cread_friendlists&selected_profiles=64...501&installed=1&session=%7B%22session_key%22%3A%222..........g7PfgULSyg__.3600.1283871600-642582501%22%2C%22uid%22%3A642582501%2C%22expires%22%3A1283871600%2C%22secret%22%3A%22egz4Inb...........__%22%2C%22sig%22%3A%22917cf28.....4f9dda6758......ba1357%22%7D]

I also managed to get it working without extended permissions but as soon as I add extended permissions it fails. The weird part is that the example linked above doesn't request extended permissions.

I'm completely lost and don't know how to solve this.

Error trying to validate the session

Once the user is authenticated using the Connect button, I get this error any time authlogic tries to validate the session:

undefined method `user' for #User:0x7f1b215fc5b0

in:

/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:260:in method_missing' /vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:80:intry'
/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:80:in `validate_by_facebook_connect'

I think the problem is with this line:
self.attempted_record = facebook_user_class.find(:first, :conditions => { facebook_uid_field => facebook_session.user.uid }).try(:"#{klass}".to_s.underscore)

It looks strange, it basically does "User.find(...).user" so it fails.

authlogic_facebook_connect breaks authlogic-oauth

after installing the authlogic_facebook_connect plugin, the oauth login with Twitter method no longer works. the error originates at authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:132:in `authenticating_with_facebook_connect?'

here's the error:
NoMethodError in User sessionsController#create
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+

here's the stack trace:
/opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:125:in fb_cookie_prefix' /opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:129:infb_cookie_names'
/opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:129:in select' /opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:129:infb_cookie_names'
/opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:135:in secure_with_cookies!' /opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:30:increate_facebook_session'
/opt/local/lib/ruby/gems/1.8/gems/facebooker-1.0.67/lib/facebooker/rails/controller.rb:44:in set_facebook_session' /opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/controller_adapters/abstract_adapter.rb:63:insend'
/opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/controller_adapters/abstract_adapter.rb:63:in method_missing' path_to_my_app/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:132:inauthenticating_with_facebook_connect?'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in send' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:inevaluate_method'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:195:in should_run_callback?' /opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/password.rb:127:inall?'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:195:in each' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:195:inall?'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:195:in should_run_callback?' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:incall'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:93:in run' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:ineach'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in send' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:inrun'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:276:in run_callbacks' /opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/callbacks.rb:72:invalidate'
/opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/validation.rb:64:in valid?' /opt/local/lib/ruby/gems/1.8/gems/authlogic-2.1.3/lib/authlogic/session/existence.rb:65:insave'
/opt/local/lib/ruby/gems/1.8/gems/authlogic-oauth-1.0.8/lib/authlogic_oauth/session.rb:46:in save' path_to_my_app/app/controllers/user_sessions_controller.rb:15:increate'

any suggestions?

how do you set the session config options?

e.g. facebook_skip_new_user_creation = true - where do you put this line?

It doesn't work in the regular acts_as_authentic block, and it doesn't work in the UserSession object.
Where should it go?

PostgreSQL Problems

I was having problems with this fantastic addon and PostgreSQL, so I made some little fixes to the queries to make them work nicely with PostgreSQL

Thank you :)

undefined method `rw_config' for UserSession:Class

I get this error when try to login with Facebook connect.
Either problem in example rails app.

Here is application trace:

/home/scream3/Temp/authlogic_example/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:37:in `facebook_uid_field'

/home/scream3/Temp/authlogic_example/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:99:in `facebook_uid_field'

/home/scream3/Temp/authlogic_example/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:59:in `validate_by_facebook_connect'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `send'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:178:in `evaluate_method'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'

/home/scream3/Temp/authlogic_example/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'

/usr/lib/ruby/gems/1.8/gems/authlogic-2.0.11/lib/authlogic/session/callbacks.rb:71:in `validate'

/usr/lib/ruby/gems/1.8/gems/authlogic-2.0.11/lib/authlogic/session/validation.rb:58:in `valid?'

/usr/lib/ruby/gems/1.8/gems/authlogic-2.0.11/lib/authlogic/session/existence.rb:63:in `save'

/home/scream3/Temp/authlogic_example/app/controllers/user_sessions_controller.rb:11:in `create'

Undefined method 'new_user'

Using the most recent version, with the session_key field added by David Li.

After a user authenticates with facebook (in the popup window), facebook redirects them to mysite.com/user_sessions, where this error is thrown:

user_sessions#create (NameError) "undefined local variable or method `new_user' for #"

And here's the end of the backtrace:

/home/mysite/releases/20091202235230/vendor/plugins/authlogic_facebook_connect/lib/authlogic_facebook_connect/session.rb:102:in `validate_by_facebook_connect'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `send'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `evaluate_method'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:in `call'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:93:in `run'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `each'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `send'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in `run'
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:276:in `run_callbacks'
/home/rails/.gem/ruby/1.8/gems/authlogic-2.1.2/lib/authlogic/session/callbacks.rb:72:in `validate'
/home/rails/.gem/ruby/1.8/gems/authlogic-2.1.2/lib/authlogic/session/validation.rb:64:in `valid?'
/home/rails/.gem/ruby/1.8/gems/authlogic-2.1.2/lib/authlogic/session/existence.rb:65:in `save'

I'm not sure what other information you need.

My callback url in facebook is mysite.com/users and the callback redirect is mysite.com/account.

Thanks in advance for your support and the plugin.

self.attempted_record.save_with_validation(false) causes errors

When I try to create a new session for a user that doesn't exist in the database it throws an error saying that the persistence_token can't be null. Perhaps I don't fully understand what I'm supposed to do to fix that problem, but if I just change your code to: "self.attempted_record.save_with_validation(true)" or even "self.attempted_record.save" everything works just fine. Did I just compromise something by making this change?

By the way I'm using facebooker 1.0.44 and authlogic 2.1.1 and the latest version of your plugin (as of July 30th).

Thanks for creating this plugin by the way!

Please update the documentation

I am new using this plugin and I had a lot of trouve to get it work straight without having to google for help.

http://groups.google.com/group/authlogic/browse_thread/thread/4d1022684421466e/c0d54c4aaa66a47f?lnk=gst&q=facebook#c0d54c4aaa66a47f

One of the updates:
class CreateFacebookconnects < ActiveRecord::Migration
def self.up
add_column :users, :name, :string
add_column :users, :facebook_uid, :integer, :limit => 8
add_column :users, :facebook_session_key, :string
end

def self.down
  remove_column :users, :facebook_uid
  remove_column :users, :name
  remove_column :users, :facebook_session_key
end

end

authlogic_facebook_connect plugin does not seem to logout fully

I'm really struggling to get the authlogic_facebook_connect plugin to behave.

Currently, the first attempt with Facebook Connect works fine, creating a new User and session with the correct uid. The problem is that any subsequent attempt to connect with a different Facebook user will always log me in as that first User.
the Session always seems to persist and the plugin loads the User based on that initial uid.

Anyone have some advice on what I'm doing wrong? or tell me how can in invalidate facebook session from my log-out method

Many thanks

Pravin

Jquery support

Hi and thanks for your work!

I'm experimenting some issues using this plugin.
In my application i use JQuery and the jrails plugin.
Your helper.rb at line 13:

output += " $('connect_to_facebook_form').submit();\n"

offers only the prototype selector.
So, we don't have support for JQuery while facebooker offers this feature.
You think that there will be in the future, or it is better a fork?

tokens

Hello,

I commented about the persistence token in an other issue yesterday but I've got just a little more material since then.
In my app right now I use 3 tokens : persistence, perishable and single_access. Following Authlogic example app (Ben's one), the three tokens should not be allowed NULL. I'd like to preserve that since I plan to have both facebook and non-facebook users.

perishable_token and single_access_token don't mess up facebook connect, and before_connect seems a good place to set them in case you have to (maybe you could add that to the readme if it is).
So my code looks like :
def before_connect(facebook_session)
self.single_access_token = Authlogic::Random.friendly_token
self.perishable_token = Authlogic::Random.friendly_token
self.first_name = facebook_session.user.first_name
self.last_name = facebook_session.user.last_name
end

Unfortunately, this doesn't work with the persistence_token.
It's really strange because if I add a persistence_token the same way I do for the two other tokens (friendly_token or hex_token), it gets impossible to login.
But, if I set the facebook_uid to an existing "regular" user (that has a persistence_token), he will be able to log in.
Also, if I manually edit the database entry and put whatever token, it will also.

So it looks like the random token generated during before_connect isn't acceptable, but I don't know why.

Do you have any clue regarding this behavior ?

Thanks

extended permissions

How does one request extended permissions? Adding a :perms key to the hash

<%#= authlogic_facebook_login_button :text => 'Login with Facebook', :v => 2, :perms => "email,user_birthday" %>

causes the FBML to render as

<form id='connect_to_facebook_form' method='post' action='/user_session'>

<input type='hidden' name='authenticity_token' value='CODE HERE'/>
</form>
<script type='text/javascript' charset='utf-8'>
function connect_to_facebook() {
$('connect_to_facebook_form').submit();
}
</script>
<fb:login-button js="prototype" onlogin="connect_to_facebook()" perms="email,user_birthday" v="2">Login with Facebook</fb:login-button>

but clicking on the button serves up the vanilla no-extended-permissions popup, so the form submission is clearly not picking up the perms key-value pair off of the login-button.

What to do?

Thanks.

Errors in testuites

Hello, and sorry for this new issue!
I've noticed that installing the plugin without any other implementation, many of my tests (units, functionals) return a NoMethodError.
In units for example:

NoMethodError: undefined method `set_facebook_session' for #ActionController::TestRequest:0xb4f53a70

I'm using rails 2.3.4, ruby 1.8.7 (Ubuntu 9.0.4) and i've installed the plugin into a fresh checkout of my trunk; before installing the plugin all my tests are ok.
Anyone got the same error?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.