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

Devise omniauth + facebook sdk #736

Closed
FreddySerg opened this issue Apr 10, 2014 · 0 comments
Closed

Devise omniauth + facebook sdk #736

FreddySerg opened this issue Apr 10, 2014 · 0 comments

Comments

@FreddySerg
Copy link

Hello.
I have a problem with auth by Facebook, Twitter, G+ and Linkedin. I tried to make auth with Facebook using their SDK. I added in devise config for Facebook { provider_ignores_state: true }.

JS now looks like:
$(function(){
  window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : APP_ID,
      status     : true,
      cookie     : true,
      xfbml      : true
    });
  };

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

  $('.facebook-auth').click(function(e){
    e.preventDefault();
    FB.login(function(response) {
      if (response.authResponse) {
        var access_token = FB.getAuthResponse()['accessToken'];
        var signedRequest = response.authResponse.signedRequest

        FB.api('/me?fields=id,name,username,email,picture', function(response) {
          window.location.href = '/users/auth/facebook/callback?image=' + response.picture.data.url + '&token=' + access_token + '&id=' +response.id + '&username=' + response.username + '&name=' + response.name + '&email=' + response.email + '&signed_request=' + signedRequest
        });
      }
    }, {scope: 'email,user_activities,friends_activities,user_likes,friends_likes,user_groups,user_photos,user_status,friends_status,read_stream,offline_access,read_friendlists,user_subscriptions,friends_subscriptions,manage_pages'});
  });
});

Auth works ok, all data received but auth using other social networks not works anymore. Error: Not found. Authentication passthru.
After server reboot all ok. Then try to signup using Facebook again and same error appears.
Can you advice why it is and how to fix it?

devise (3.2.3)
omniauth (1.1.4)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.1.1)

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

2 participants