Skip to main content
# Integrating Platform Authentication Module

Step 1: Install the Platform Authentication Module

pip install platform-authentication

Step 2: Add to Installed Apps

Update your project's INSTALLED_APPS setting in settings.py:

INSTALLED_APPS = [
    # ...,
    'platform_authentication',
]

Step 3: Configure Middleware and Create Custom Middleware

Create a new file middleware.py in your project and add the following code:

from platform_authentication.middleware import JWTMiddleware

# Project-Specific Imports

# Relative Import

class CustomJWTMiddleware(JWTMiddleware):
    def _is_excluded_endpoint(self, endpoint):
        """Helper method to check if an endpoint is excluded from subscription checks."""
        pass
        # Your logic for checking if the endpoint is excluded from authentication check

Now, add the custom middleware to your project's middleware in settings.py:

MIDDLEWARE = [
    # ...,
    'your_path_to.custom_middleware.CustomJWTMiddleware',
    # ...,
]

Step 4: Fake Migrations

Run the following command to fake migrations for the platform_authentication app:

python manage.py migrate platform_authentication --fake

Step 5: Secret Key Replacement

Replace the secret key in your child project with the secret key from platform-authentication. Keep the secret key secure.

# Example:
# parent_project_secret_key = '<some_secret_key1>'

# child_project_secret_key = '<parent_project_secret_key>'

Note: Ensure to replace placeholder values (<some_secret_key1>, <parent_project_secret_key>) with your actual secret keys.

Configuration

To configure the authentication settings for your project, you can use the following settings in your Django project's settings.py file:

SIMPLE_JWT = {
    'AUTH_HEADER_TYPES': ('JWT', "Bearer",),
    'USER_ID_FIELD': 'username',
}

Now, your Django project is integrated with the platform_authentication module for streamlined user authentication.

Release files for platform-authentication 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for platform-authentication 0.0.5
File Size Uploaded
platform_authentication-0.0.5.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for platform-authentication 0.0.5
File Interpreter ABI Platform
platform_authentication-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 51.3 kB

Release files / platform_authentication-0.0.5.tar.gz

Download URL platform_authentication-0.0.5.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
12e51161ce334d50dca95ab1d1c436fe6d4ceb2eecb890ca0592853130fab089
BLAKE2b-256 checksum
How to use checksums
64d485d9172698f315fb50650aadbbf8e3dc9f35156f5365aff65d440ac13f6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / platform_authentication-0.0.5-py3-none-any.whl

Download URL platform_authentication-0.0.5-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d47a802535cc529bf25ac7e9272679422f9b41377a3682d2df2c3222ddd6ea7e
BLAKE2b-256 checksum
How to use checksums
e51e27565694aaf59bf31272c0b8df2f3216919a9b46aafda6bcf9cae5fc55c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page