Skip to main content

REST API endpoints for Authentication and Registration

Project description

DRF Authentication

Quickstart

For installing django-drf-auth, just run this command in your shell

pip install django-drf-auth

settings

INSTALLED_APPS = (
    # ...
    'django.contrib.sites',
    'rest_auth',
    'allauth',
    'allauth.account',
    'rest_auth.registration',
    'drf_auth',
)


FRONT_URL = '' 
EMAIL_HOST_USER = '' 
EMAIL_HOST_PASSWORD = '' 
EMAIL_PORT = 587 

REST_USE_JWT = True
SITE_ID = 1

ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_EMAIL_REQUIRED = True

FRONT_URL -> this is your url https://www.example.com

URLS

urlpatterns = [
    # ...
    path('drf_auth/', include('drf_auth.urls')),
]

API Endpoints:

Register

Method: POST
Endpoint: /registration/
Payload:
{ "username": "USERNAME", "password1": "PASSWORD", "password2": "PASSWORD", "email": "EMAIL" }

Register Confirm Email

Method: POST
Endpoint: /account-confirm-email/<str:key>/
Payload:
{ "key": "KEY", }

Login

Method: POST
Endpoint: /login/
Payload:
{ "username": "USERNAME", "password": "PASSWORD" }

Logout

Method: POST
Endpoint: /logout/
Headers: Authorization: JWT YOUR_TOKEN_HERE

Change Password

Method: POST
Endpoint: /password/change/
Payload:
{ "old_password": "OLD PASSWORD", "new_password1": "NEW PASSWORD1", "new_password2": "NEW PASSWORD2" }

Reset Password

Method: POST
Endpoint: /password/reset/
Payload:
`{
"email": "EMAIL ADDRESS",

}`

Reset Password Confirm

Method: POST
Endpoint: /password/reset/confirm/<str:uid>/<str:token>/
Payload:
`{
"uid": "UID",
"token": "token",

}`

Reset Password Confirm

Method: GET
Endpoint: /user/
Headers: Authorization: JWT YOUR_TOKEN_HERE

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

django-drf-auth-0.1.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file django-drf-auth-0.1.tar.gz.

File metadata

  • Download URL: django-drf-auth-0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for django-drf-auth-0.1.tar.gz
Algorithm Hash digest
SHA256 954703b8d9f5f3966cbd63d1b0a42f0d38d47694945893553850b7bc9d217c02
MD5 ef58b2f961c2130cd5477e9fc038e49f
BLAKE2b-256 c9e78e92bb865f2c7ea1cdf2f1e8b30cc361007c95a79de83bc8f4be1cbf3152

See more details on using hashes here.

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