내 장고 앱에 대한 페이스 북 로그 아웃 기능을 구현하려고합니다. 페이스 북의 로그인은 나를 위해 잘 작동합니다. 이제 로그 아웃하고 어떻게 든 세션을 지울 필요가 있습니다. 내가 아래 코드를 사용하려고했으나 'FB.Connect not defined'오류가 발생했습니다. 누군가 내 코드를보고 해결책을 제시 할 수 있습니까?FB 로그 아웃을 구현하는 동안 Fb.Connect가 정의되지 않았습니다.
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : 'xxx',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<script>
function logout(){
FB.logout(function(response) {
// user is now logged out
location.href = '/user_sessions/new';
});}
// handle a session response from any of the auth related calls
function handleFBSessionResponse(response) {
/*
//Check the facebook login status
alert("handleFBSessionResponse(), "
+ "\nresponse.status="+response.status
+" \nresponse.session="+response.session
+" \nresponse.perms="+response.perms);
*/
//if we do have a non-null response.session, call FB.logout(),
//the JS method will log the user out
//of Facebook and remove any authorization cookies
FB.logout(handleFBSessionResponse);
}
</script>
<a href="javascript:logout();">Logout</a >
또는 구현하기 쉬운 다른 간단한 방법이 있습니까? 그렇다면이 코드를 여기에 게시하십시오.
작업있어? –
코드를 변경했습니다. 컨트롤이 Fb.connect.logout() 내부로 들어 가지 않습니다. 호출하는 것이 올바른 방법입니까? –