Skip to main content

A simple Django application for AJAX authorisation.

Project description

# django-xauth

[![PyPI version](](

Some simple AJAX authorisation endpoints for Django.

## Why?

I wanted a package to integrate AJAX authorisation with Django's
standard authorisation views. When a request is made via AJAX it
should be handled as such, and when a standard request is made the
login form should be rendered.

## Installation

`pip` is the easiest way to get the package:

pip install django-ajax-auth

Add the package to your Django settings file:


Replace the standard authorisation URLs in your URL configuration:

urlpatterns = [
url(r'^', include('xauth.login_ajax_urls'))

## Usage

Now you can either perform the usual non-AJAX GET and POST to login
as you would normally, or POST using `application/json` encoding to
login over AJAX.

import $ from 'jquery'

url: '/login',
method: 'POST',
contentType: 'application/json',
data: {
username: 'harry',
password: 'henderson123'

Sometimes you may wish to only allow AJAX logins, in which case set
`XAUTH_AJAX` to `True` in your settings file.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ajax-auth-0.1.1.tar.gz (6.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page