Skip to content

apptension/django-restauth

Repository files navigation

🍔 django-restauth

Build Status

Running

pip install pipenv
pipenv install
pipenv run python manage.py runserver

Usage

  • Modify your settings
# ..

AUTH_USER_MODEL = 'restauth.User'

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ),
}

JWT_AUTH = {
    'JWT_ENCODE_HANDLER': 'restauth.jwt.encode_handler',
}

HASHID_FIELD_SALT = ''
  • Generate HASHID_FIELD_SALT

from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())

  • Modify urls.py

Features

  • Register user with profile in single API call
  • Login endpoint to return JWT token
  • User account activation endpoint
  • User profile endpoint
  • HashID for User primary key
  • Password reset & change endpoints
  • Add Swagger for API documentation
  • Ability to set user notification implementation
  • Health check endpoint with DB migrations validation
  • Two separate hosts, api & admin using django-hosts