2012-04-24 5 views
0

기압 메신저가 작동하려면 페이스 북의 API를 얻으려고 노력 Occurrred, 나는페이스 북 자바 스크립트의 OAuth 오류가

오류 나는 오류가 로그인

<!DOCTYPE html> 
<head> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
</head> 
<body> 
<fb:login-button autologoutlink="true" onlogin="OnRequestPermission();"> 
</fb:login-button> 
<script language="javascript" type="text/javascript"> 
    FB.init({ 
     appId: '143655195699763', 
     status: true, 
     cookie: true, 
     xfbml: true 
    }); 
</script> 
</body> 
</html> 

지금까지 내가 시도로의 OAuth에 붙어 발생했습니다. 나중에 다시 시도 해주십시오.

어떤 아이디어가 있습니까?

또한 그 중 하나를 사용하는 경우에도 여전히 동일한 오류 메시지가 표시됩니다. 아마도 내 appID와 함께 할 일이 있을까요?

<!DOCTYPE html> 
<head> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
</head> 
<body> 
<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : '395527397147712', // App ID 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
    }); 
    }; 
</script> 
<script> 
function fb_publish() { 
    FB.ui(
     { 
     method: 'stream.publish', 
     message: 'Message here.', 
     attachment: { 
      name: 'Name here', 
      caption: 'Caption here.', 
      description: (
      'description here' 
      ), 
      href: 'url here' 
     }, 
     action_links: [ 
      { text: 'Code', href: 'action url here' } 
     ], 
     user_prompt_message: 'Personal message here' 
     }, 
     function(response) { 
     if (response && response.post_id) { 
      alert('Post was published.'); 
     } else { 
      alert('Post was not published.'); 
     } 
     } 
    ); 
    } 

</script> 

<input name="" type="button" onClick="fb_publish()"> 

</body> 
</html> 
+0

유일한 코드가 있습니까? [this] (https://developers.facebook.com/docs/reference/javascript/)을 읽으셨습니까? –

+0

새 코드로 첫 번째 게시물이 업데이트되었습니다. –

+0

브라우저의 콘솔에서 무엇이 보이십니까? FB는 오류에 대한 자세한 정보를 기록합니다. – Marc

답변

0

나는 이것이 원인인지 확실하지 않다,하지만 SDK 문서의 예에서 두 가지 기능을 하나 fb.init되어있다 (당신이 그것을 가지고)과 다른 하나는 자신을 호출하는 익명 함수입니다 DOM에 직접 첨부 할 스크립트를로드하십시오. 아마도 익명 함수를 통해 스크립트를로드해야합니다. 코드 :

<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : 'YOUR_APP_ID', // App ID 
     channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
    }); 

    // Additional initialization code here 
    }; 

    // 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)); 
</script> 

ALOS는, IE의 SDK가 문제를 일으킬 수 있기 때문에 제대로 #fb-root 요소를 숨길 수 있는지 확인하십시오. More info here