Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current_facebook_user get error "This authorization code has been used." #85

Open
derrimahendra opened this issue Dec 10, 2012 · 12 comments

Comments

@derrimahendra
Copy link

Hi All

I can login using facebooker2, and on my home page I use current_facebook_user but I get error "This authorization code has been used." Mogli::Client::OAuthException.

a few month ago it doesn't happen.

any body can help me?

@mmangino
Copy link
Owner

What are you storing? Once you use the oauth code to get a facebook session, you need to store the session info and discard the token.

Mike

On Dec 10, 2012, at 4:12 AM, derri notifications@github.com wrote:

Hi All

I can login using facebooker2, and on my home page I use current_facebook_user but I get error "This authorization code has been used." Mogli::Client::OAuthException.

a few month ago it doesn't happen.

any body can help me?


Reply to this email directly or view it on GitHub.

@menan
Copy link
Contributor

menan commented Dec 10, 2012

Hey Mike, This is the same error I am getting. I think it's because Facebook changed some stuff recently. This is my stack trace that I posted on Mogli.


/Users/alexandrecarriere/.bundler/ruby/1.8/mogli-b8f68b5d7e44/lib/mogli/client.rb:79:in `raise_error_by_type_and_message'
/Users/alexandrecarriere/.bundler/ruby/1.8/mogli-b8f68b5d7e44/lib/mogli/client.rb:70:in `raise_client_exception'
/Users/alexandrecarriere/.bundler/ruby/1.8/mogli-b8f68b5d7e44/lib/mogli/client.rb:52:in `create_from_code_and_authenticator'
/Users/alexandrecarriere/.bundler/ruby/1.8/facebooker2-504cc261af61/lib/facebooker2/rails/controller.rb:231:in `oauth2_fetch_client_and_user_from_cookie'
/Users/alexandrecarriere/.bundler/ruby/1.8/facebooker2-504cc261af61/lib/facebooker2/rails/controller.rb:221:in `oauth2_fetch_client_and_user'
/Users/alexandrecarriere/.bundler/ruby/1.8/facebooker2-504cc261af61/lib/facebooker2/rails/controller.rb:16:in `current_facebook_user'
app/controllers/application_controller.rb:31:in `current_user'
app/controllers/users_controller.rb:28:in `show'


@derrimahendra
Copy link
Author

Hi Mike for until a few month ago it still work, i can login and i can fetch current_facebook_user, now i just can login but can't fetch current_facebook_user, i try to remove fbsr cookies but it just remove the cookie and still can't fetch current_faebook_user.

I just add facebooker2 and authlogic_facebook_connect together. it's work before.

@mmangino
Copy link
Owner

You should be able to get it once per login. Once you exchange the auth code for a token, you'll need to store the token and rebuild the user from that.

Mike

On Dec 10, 2012, at 7:56 PM, derri notifications@github.com wrote:

Hi Mike for until a few month ago it still work, i can login and i can fetch current_facebook_user, now i just can login but can't fetch current_facebook_user, i try to remove fbsr cookies but it just remove the cookie and still can't fetch current_faebook_user.

I just add facebooker2 and authlogic_facebook_connect together. it's work before.


Reply to this email directly or view it on GitHub.

@ciscodesign
Copy link

Same problem form me

mogli (0.0.36) lib/mogli/client.rb:79:in raise_error_by_type_and_message' mogli (0.0.36) lib/mogli/client.rb:70:inraise_client_exception'
mogli (0.0.36) lib/mogli/client.rb:52:in create_from_code_and_authenticator' (eval):2:insend'
(eval):2:in current_facebook_user' app/views/layouts/_menu_user_right.html.erb:8 /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:392:inrender'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:in trace_execution_scoped' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:387:inrender'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:392:in render_partial' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:intrace_execution_scoped'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:387:in render_partial' app/views/layouts/_menu.html.erb:21 /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:392:inrender'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:in trace_execution_scoped' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:387:inrender'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:392:in render_partial' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:intrace_execution_scoped'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:387:in render_partial' app/views/layouts/home.html.erb:56 /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:392:inrender'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:in trace_execution_scoped' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:387:inrender'
app/controllers/pages_controller.rb:143:in home' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:255:inperform_action'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/method_tracer.rb:191:in trace_execution_scoped' /data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:248:inperform_action'
warden (0.10.7) lib/warden/manager.rb:35:in call' warden (0.10.7) lib/warden/manager.rb:35:incall'
warden (0.10.7) lib/warden/manager.rb:34:in catch' warden (0.10.7) lib/warden/manager.rb:34:incall'
/data/groupsale/shared/bundled_gems/ruby/1.8/gems/newrelic_rpm-3.1.0/lib/new_relic/rack/browser_monitoring.rb:18:in call' devise (1.0.11) lib/devise/rails/warden_compat.rb:43:incall'

How can i solve?

@mmangino
Copy link
Owner

I just pushed a completely untested change that should cache the required info. Can you try running with the facebooker2 from git to see if that fixes things?

@derrimahendra
Copy link
Author

I install it as plugin,this is what I get:

ActionView::TemplateError (Constant Facebooker2::Rails::Controller::Moglie from facebooker2/rails/controller/moglie.rb not found
Constant Facebooker2::Rails::Moglie from facebooker2/rails/moglie.rb not found
Constant Facebooker2::Moglie from facebooker2/moglie.rb not found
Constant Moglie from moglie.rb not found) on line #17 of themes/dappled/views/shared/_user_menu.html.haml:

@mmangino
Copy link
Owner

I just fixed the type. Can you try again?

Mike

On Dec 12, 2012, at 10:36 AM, derri notifications@github.com wrote:

I install it as plugin,this is what I get:

ActionView::TemplateError (Constant Facebooker2::Rails::Controller::Moglie from facebooker2/rails/controller/moglie.rb not found
Constant Facebooker2::Rails::Moglie from facebooker2/rails/moglie.rb not found
Constant Facebooker2::Moglie from facebooker2/moglie.rb not found
Constant Moglie from moglie.rb not found) on line #17 of themes/dappled/views/shared/_user_menu.html.haml:


Reply to this email directly or view it on GitHub.

@derrimahendra
Copy link
Author

I get this :
undefined method `sign_in_user_and_client' for #BaseController:0xc2ee850

there a typo lib/facebooker2/rails/controller.rb line 234

if i change it to fb_sign_in_user_and_client it's work fine

@derrimahendra
Copy link
Author

i'm sorry when I try to logout and try to sign in again, this i what I get:

Mogli::Client::OAuthException (Error validating access token: The session is invalid because the user logged out.):

@mmangino
Copy link
Owner

I added an fb_logout! method that you can call when that error is raised. You should be able to call that and then go through the login process.

Mike

On Dec 12, 2012, at 10:51 AM, derri notifications@github.com wrote:

i'm sorry when I try to logout and try to sign in again, this i what I get:

Mogli::Client::OAuthException (Error validating access token: The session is invalid because the user logged out.):


Reply to this email directly or view it on GitHub.

@derrimahendra
Copy link
Author

It's work for now, I'll check it again tomorrow

Thanks Mike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants