0
인증 대화 상자에 인증 된 추천에 문제가 있습니다. 사용자가 처음으로 앱을 사용하고 승인을 요청할 때 "그 앱은 귀하의 기본 데이터를받습니다."라는 메시지를 받게됩니다. Facebook 개발자 앱 사이트에서 승인 대화 상자를 미리 볼 때 표시되는 내용과 다릅니다. 다음 코드를 사용합니다 :Facebook의 인증 된 추천이 작동하지 않습니다.
<script>
// Load the SDK Asynchronously
(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 : '<%= Facebook::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
xfbml : true // parse XFBML
});
url = '<%= users_path %>'
// listen for and handle auth.statusChange events
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) {
window.open(url);
}
})
} else {
// user has not auth'd your app, or is not logged into Facebook
document.getElementById('auth-loggedout').style.display = 'block';
}
});
// respond to clicks on the login and logout links
document.getElementById('auth-loginlink').addEventListener('click', function(){
FB.login();
});
}