Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用python social auth在Django应用程序上注销facebook本身?_Python_Django_Facebook_Facebook Apps_Python Social Auth - Fatal编程技术网

如何使用python social auth在Django应用程序上注销facebook本身?

如何使用python social auth在Django应用程序上注销facebook本身?,python,django,facebook,facebook-apps,python-social-auth,Python,Django,Facebook,Facebook Apps,Python Social Auth,对不起,我有个问题。 我用Django和python social Auth编写了facebook Auth脚本。 我可以在我的Web应用程序上“注销”。 例如,即使我打开一个带有“@login\u required”装饰符的页面(视图),我也无法打开该页面。 但是,我无法“注销”facebook本身。 例如,当我点击“使用facebook登录”时,我可以在不访问facebook页面的情况下登录facebook,当我访问facebook时,我的墙就会出现 我用PHP找到了一个方法 functio

对不起,我有个问题。 我用Django和python social Auth编写了facebook Auth脚本。 我可以在我的Web应用程序上“注销”。 例如,即使我打开一个带有“@login\u required”装饰符的页面(视图),我也无法打开该页面。 但是,我无法“注销”facebook本身。 例如,当我点击“使用facebook登录”时,我可以在不访问facebook页面的情况下登录facebook,当我访问facebook时,我的墙就会出现

我用PHP找到了一个方法

function logout() {
    $this->session->sess_destroy();
    $this->facebook->destroySession();
    redirect('index/', 'location');
}
但是我如何通过我的网络应用程序使用Python3和Django1.9注销facebook呢

多谢各位

views.py

from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.template.context import RequestContext


def login(request):
    context = RequestContext(request, {
        'request': request, 'user': request.user})
    return render(request, 'myapp/login/login.html' context_instance=context)


@login_required(login_url='/')
def home(request):
    return render(request, 'myapp/login/home.html')


def logout(request):
    auth_logout(request)
    return redirect('/')

我没有使用python social auth,但从技术上讲,您不能


当用户通过Outh2.0登录时,会将用户定向到社交网站的URL,用户在该URL中登录到该社交网站。之后,社交网站会调用其中一个URL或方法,告诉您用户已通过身份验证。您的服务器或代码从未参与此登录过程,因此您不能干扰它并注销用户。

我认为您不能使用python注销用户。也见此

但您可以使用Javascript SDK轻松注销用户:

<a href="/logout" onclick="FB.logout();">Logout</a> 


谢谢你,ilse2005。我将改用JavaScript。非常感谢。谢谢你的建议,穆罕默德·塔希尔。我得到了它。我将实现SDK。非常感谢你。