3
나는 fb js sdk로 omniauth-facebook에서 일하고 있습니다. 그것은 지금 당장은 꽤 잘 작동하지만, 왜 여분의 권한을 요청할 수 있는지 모르겠습니다. 나는 omniauth.rb : omniauth-facebook의 범위를 이미 설정했지만 로그인을 클릭하면 사용자가 요청할 추가 권한이 없습니다. 나는 인터넷을 통해 추구하고 내가 좋아 할 필요가 있음을 발견 : facebook javascript sdk omniauth-facebook으로 추가 권한을 얻으십시오.
FB.login(function(response) {
// handle the response
}, {scope: 'email,user_likes'});
하지만 내 경우에는
, 나는 클라이언트 측을 따라이 나오 : 내가 사회 페이스 북을 사용하는 경우(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();
});
}
버튼을 클릭하고 범위를 html로 추가하면 작동하지만 원하는 것은 아닙니다. 여기있는 사람은 나에게 진행을위한 지침서 나 힌트가 있습니까?