facebook javascript sdk get extra permissions with omniauth-facebook

I’m working on omniauthfacebook with fb js sdk. It works pretty good for right now, however I do not know why it cannot request extra permissions. I already set in my omniauth.rb :scope for omniauth-facebook ,but when I click login, I don’t get any extra permission that I want to request from user. I seek over the internet and found out that I have to do like:

FB.login(function(response) {
// handle the response
}, {scope: 'email,user_likes'});

But in my case, I follow the client side and come out with this:

  • Blank screen on Facebook login on Edge browser
  • facebook graph api picture
  • Is it possible to keep the Facebook session alive?
  • Facebook Like button shows the “Confirm” link, but still cannot Like after confirming
  • Facebook login for Django and url redirection?
  • How to wait to render view in react.js until $.get() is complete?
  •   (function(d){
         var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         ref.parentNode.insertBefore(js, ref);
       }(document));
    
      // Init the SDK upon load
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'app_id', // App ID
          channelUrl : '//'+window.location.hostname+'/channel', // Path to your Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
      oauth      :true, //enable Oauth 2.0
          xfbml      : true  // parse XFBML
        });
    
        // listen for and handle auth.statusChange events
    //
    FB.Event.subscribe('auth.login', function(response) {
      if (response.authResponse) {
        window.location = '/auth/facebook/callback';
      }
    }, {scope: 'email,user_likes'});  //i tried but its not working
    
        FB.Event.subscribe('auth.statusChange', function(response) {
          if (response.authResponse) {
            // user has auth'd your app and is logged into Facebook
            FB.api('/me', function(me){
              if (me.name) {
                document.getElementById('auth-displayname').innerHTML = me.name;
              }
            })
            document.getElementById('auth-loggedout').style.display = 'none';
            document.getElementById('auth-loggedin').style.display = 'block';
          } else {
            // user has not auth'd your app, or is not logged into Facebook
            document.getElementById('auth-loggedout').style.display = 'block';
            document.getElementById('auth-loggedin').style.display = 'none';
          }
        });
    
        // respond to clicks on the login and logout links
        document.getElementById('auth-loginlink').addEventListener('click', function(){
          FB.login();
        });
    
    
        document.getElementById('auth-logoutlink').addEventListener('click', function(){
          FB.logout();
        }); 
      } 
    

    If I use facebook social button and add the scope in html there, it works, but that’s not what I want. Anyone here got tutorial or hints for me to proceed?

  • facebook “apprequests” with Custom URL?
  • Scroll to top of facebook messages
  • Triggering Synthetic Event in React App
  • Facebook XMPP chat API - device priority
  • Check if user posted (or cancelled) sharing to Facebook in Share Dialog using FB.ui
  • Get signed_request in Node.js (Express) Facebook canvas app
  • One Solution collect form web for “facebook javascript sdk get extra permissions with omniauth-facebook”

    What about this:

    jQuery ->
      $('body').prepend('<div id="fb-root"></div>')
    
      $.ajax
        url: "#{window.location.protocol}//connect.facebook.net/en_US/all.js"
        dataType: 'script'
        cache: true
    
    
    window.fbAsyncInit = ->
      FB.init(appId: '<%= ENV["FACEBOOK_KEY"] %>', cookie: true)
    
      $('#sign_in').click (e) ->
        e.preventDefault()
        FB.login (response) ->
          window.location = '/auth/facebook/callback' if response.authResponse
      , scope: "email, publish_stream"    
    
      $('#sign_out').click (e) ->
        FB.getLoginStatus (response) ->
          FB.logout() if response.authResponse
        true