Skip to main content

An app to manage easily the authentication in Rest API.

Project description

DJANGO-RESTFRAMEWORK-AUTHENTICATION

DJANGO-RESTFRAMEWORK-AUTHENTICATION is an app to manage easily the authentication in Rest API. This library supports classical Django’s and Json Web Token authentication, moreover it manages Google 0Auth 2.0

Quick start

  1. Add “authentication” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...,
        "rest_framework",
        "authentication",
    ]
    
    If you are using JWT add "rest_framework_simplejwt"::
    
        INSTALLED_APPS = [
            ...,
            "rest_framework",
            "authentication",
            "rest_framework_simplejwt",
        ]
  2. Include the “authentication” URLconf in your project urls.py like this:

    path("api/", include("authentication.urls")),
  3. GOOGLE OAUTH 2.0

To use Google OAuth 2.0 you must set in settings.py:

GOOGLE_AUTHENTICATION = True GOOGLE_AUTHENTICATION_CLIENT_ID = “your_client_id” GOOGLE_AUTHENTICATION_CLIENT_SECRET = “your_client_secret”

You should set GOOGLE_AUTHENTICATION_CLIENT_SECRET as enviroment variable because it is a sensible information.

  1. JWT AUTHENTICATION

To use JWT authentication you must set in settings.py:

JWT_AUTHENTICATION = True

Remember add rest_framework_simplejwt to INSTALLED_APPS.

You are free to use the authentication system that you wan. You can use either Google OAuth or JWT, and you can use both as well.

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

djangorestframework-authentication-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file djangorestframework-authentication-0.1.1.tar.gz.

File metadata

File hashes

Hashes for djangorestframework-authentication-0.1.1.tar.gz
Algorithm Hash digest
SHA256 30b14adf42c5900950f75ceee07467c8b9eca1673b0d106fa6d9fc7505138a7b
MD5 68d9ec4cd5e4b9d541690ab2580688aa
BLAKE2b-256 52d188c4fb24dba7914f2b5cfe2d0062dbde033134045b9dc199c2090258e62e

See more details on using hashes here.

Supported by

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