Beispiel #1
0
def FacebookAuth(request):
    if request.method == "GET":
        d = {
            'redirect_uri': redirect_uri('/login/success', '/login/fail'),
            'client_id': settings.FACEBOOK_APP_ID,
            'scope': 'email'
        }
        return JsonResponse(data=d, status=201)
Beispiel #2
0
def handler(request):
    next_url = urls.Next().decode(request.GET['next'])
    if 'code' not in request.GET:
        return http.HttpResponseRedirect(next_url['close'])
    user = authenticate(
        code=request.GET['code'],
        redirect_uri=urls.redirect_uri(next_url['next'], next_url['close']))
    if user:
        login(request, user)
    response = http.HttpResponseRedirect(next_url['next'])
    response["P3P"] = ('CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi'
                       ' CONi HIS OUR IND CNT"')
    return response