2010-03-29 4 views
0

iframe 응용 프로그램에 심각한 문제가 있습니다. 많은 외부 JS 라이브러리 및 기타 동적 stuuf 사용해야하므로 FMBL 응용 프로그램을 수행 할 수 없습니다. require_login()을 호출하면 응용 프로그램이 아직 설치되지 않았을 때 대화 상자를 설치하는 응용 프로그램이 표시됩니다. 그런 다음 인증 응용 프로그램이 auth_token과 같은 매개 변수가있는 끝없는 리디렉션 루프에 들어가면 설치됩니다. 어제는이 문제를 해결할 수 있었지만 오늘은 다시 깨졌습니다 ... FB로 무슨 일이 벌어지고 있습니까? 그것은 해결책을 찾기 위해 나를 미치게 만들었습니다. 그물에서 발견 된 것들은 아무 것도 작동하지 않는 것 같습니다.iFrame의 Facebook require_login() 앱

는 지금까지 시도 :

http://abhirama.wordpress.com/2010/03/07/facebook-iframe-xfbml-app/ 위의

http://www.markdeepwell.com/2010/02/validating-a-facebook-session-within-an-iframe/ http://forum.developers.facebook.com/viewtopic.php?pid=210449 http://www.ajaxlines.com/ajax/stuff/article/facebook_fbml_rendering_in_iframe_application.php http://www.aratide.com/php/solving-the-break-out-issue-in-iframe-facebook-applications/

아무도 일하지 (! 2010년 3월 7일) http://forum.developers.facebook.com/viewtopic.php?pid=156092 http://www.keywordintellect.com/facebook-development/how-to-set-up-a-facebook-iframe-application-in-php-in-5-minutes/

... 사람들에 따르면, 일부 FB 문서 : http://wiki.developers.facebook.com/index.php/Cross_Domain_Communication_Channel

내 예를 들어, 테스트 파일가 다음과 같이보고 :

<?php 
//Link in library. 
require_once '../application/vendor/Facebook/facebook.php'; 

//Authentication Keys 
$appapikey = 'XXXX'; 
$appsecret = 'XXXX'; 

//Construct the class 
$facebook = new Facebook($appapikey, $appsecret); 

//Require login 
$user_id = $facebook->require_login(); 

?> 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head> 
    <title></title> 
</head> 
<body> 
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> 
    This is you: <fb:name uid="<?php echo $user_id?>"></fb:name> 
    <?php var_dump($facebook->$this->facebook->api_client->friends_get())?> 
    <script type="text/javascript"> 
FB_RequireFeatures(["XFBML"], function(){ 
    FB.Facebook.init("<?=$appapikey?>", "xd_receiver.html"); 
}); 
    </script> 
</body> 
</html> 

그리고 크로스 도메인 파일 xd_receiver.html입니다 : 제대로 작동

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
    <head> 
    <title>cross-domain receiver page</title> 
    </head> 
    <body> 
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script> 
    </body> 
</html> 

어떻게받을 수 있나요?

나는 이것을하기 위해 Kohana 프레임 워크를 사용하고 있으며 이미 facebook PHP 라이브러리의 url :: redirect()로 header ('Location')를 대체했습니다.

답변

0

페이스 북은 많은 HTML 태그의 사용을 제한합니다. 코드에서 일부 제한된 태그를 사용하고있는 것으로 보입니다. 그걸 제거하려고 했습니까? 경우

당신은 당신이보고있는 튜토리얼의

+0

iframe 응용 프로그램입니다.나는 iframe 내부에서 require_login을 호출하려고 시도하고, 페이스 북 외부에서 내 애플리케이션의 URI로 auth_token 변수로 무한 루프로 끝나는 내 애플리케이션으로 리디렉션된다. 나는 FBML 응용 프로그램을 만들려고했는데 을 사용하여 캔버스에 iframe을 넣으려고했지만 흐름은 동일합니다. –

1

많은 아주 오래된 있습니다 (예를 들어, 대한 <body>) 해당 태그를 사용하여 그것을 대신 FBML의 iframe이 응용 프로그램을 만들고 싶어. 페이스 북 API와 동반 된 SDK는 상당히 빠르게 변하고, 그것이 "오래된"방식으로는 불가능하다는 의미는 아니지만, 그 방식은 손상되거나, 비추천되거나, 제거되거나, 잘 문서화되지 않을 가능성이 더 큽니다. https://github.com/facebook/php-sdk/

그런 다음 당신은 당신이 뭘 하려는지에 대한 기본이 예제를 사용할 수 있습니다 : 최신 PHP 용 SDK에 대한 더 나은 지원 시도의 업그레이드를위한

https://github.com/facebook/php-sdk/blob/master/examples/example.php

그것은 사용자에게 제공합니다 링크 로그인,하지만 당신은 로그인 한 (모방 require_login 세) 사용자, 당신은 대체 할 수있는 콘텐츠를 보여주는, 당신이 로그인을 강제하려는 상황에 있다면 :

// Login or logout url will be needed depending on current user state. 
if ($user) { 
    $logoutUrl = $facebook->getLogoutUrl(); 
} else { 
    $loginUrl = $facebook->getLoginUrl(); 
} 

재치 h :

// Get logout URL, or redirect user to login URL 
if ($user) { 
    $logoutUrl = $facebook->getLogoutUrl(); 
} else { 
    header('Location: ' . $facebook->getLoginUrl()) ; 
}