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

Users are signed out before callback #5

Open
theodorton opened this issue Apr 12, 2013 · 8 comments
Open

Users are signed out before callback #5

theodorton opened this issue Apr 12, 2013 · 8 comments

Comments

@theodorton
Copy link

In the case where I have already authenticated my user, and I'm trying to connect their Google Apps-account. The existing user seems to be signed out before my callback in OmniauthCallbacksController.

I've verified this. It does not happen with the omniauth-facebook gem.

I've tried to go through the code of the gem to identify where this happens, but no success so far.

Any ideas?

@sishen
Copy link
Owner

sishen commented Apr 12, 2013

Do you have multiple google accounts signed in?

@theodorton
Copy link
Author

No. I'm signing in with Facebook. Then I attempt to connect with google apps, and current_user is cleared.

Thanks for prompt reply! 👍

@theodorton
Copy link
Author

I figured it out. For some strange reason I had to add:

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController   
  skip_before_filter :verify_authenticity_token
  ...
end

@sishen
Copy link
Owner

sishen commented Apr 12, 2013

Ah. The rails is detecting the CSRF attack and if the post request doesn't contain the token, will reset all the session data.

@theodorton
Copy link
Author

Thank you for clarifying, I wasn't aware of that :) It still doesn't explain why it worked the other way around with Google Apps prior to Facebook authentication. May be that the omniauth-facebook gem does something to prevent this.

@sishen
Copy link
Owner

sishen commented Apr 12, 2013

You can check the log. Maybe it's GET request instead of POST request for omniauth-facebook. However, I'm not sure. Glad you figured it out.

@sishen
Copy link
Owner

sishen commented May 1, 2013

Copy from #6 by @tomjoro.

Add this to your Gemfile, and run bundle install (needs permissions).
gem "ruby-openid", :git => "git://github.com/kendagriff/ruby-openid.git", :ref => "79beaa419d4754e787757f2545331509419e222e"

If you still meet problems, comment here pls.

@kendagriff
Copy link

Thanks @sishen, I've submitted the pull request.

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

3 participants