Skip to main content

Using auth-passwordless-kavenegar Package

Installation

First, you need to add the following model to your user model:

from django.contrib.auth.models import AbstractUser
from django.db import models

class User(AbstractUser):
    username = None
    password = None
    mobile = models.CharField(
        max_length=13, 
        unique=True,
        db_index=True,
        help_text="Required. 13 characters mobile number",
        error_messages={
            "unique": ("A user with that mobile already exists."),
        },
        verbose_name='mobile'
    )

    USERNAME_FIELD = "mobile"

Then add the following apps to your settings:

INSTALLED_APPS = [
    ...
    'rest_framework',
    'drfpasswordless',
    'rest_framework_simplejwt',
    'auth-passwordless-kavenegar',
    ...
]

Also, add the following configurations to your settings:

REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
    'PAGE_SIZE': 10,
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_simplejwt.authentication.JWTAuthentication',
    ),
}

And include the following URLs in your main urls.py:

from django.urls import path, include

urlpatterns = [
    ...
    path('', include('auth-passwordless-kavenegar.urls')),
    ...
]

Usage

Endpoints

This package provides the following endpoints for authentication:

  • /auth/login/: For user login request.
  • /auth/verify/: For verifying the code sent to the user.
  • /auth/refresh/: For token refreshing.

Note that if the user does not exist, they will be registered automatically, which can be adjusted from the settings.

Installation

To use this package, first, make sure to add the following information to your Django project settings:

  • KAVENEGAR_API_KEY: API key for Kavenegar SMS service.
  • KAVENEGAR_TEMPLATE: Template ID for the SMS message.

Then, install the package using pip:

pip install auth-passwordless-kavenegar

Metadata

Release files for auth-passwordless-kavenegar 0.1.0

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

Source distribution (sdist)

Source distribution for auth-passwordless-kavenegar 0.1.0
File Size Uploaded Provenance Actions
auth-passwordless-kavenegar-0.1.0.tar.gz 3.7 kB Without provenance Details for auth-passwordless-kavenegar-0.1.0.tar.gz

Release files / auth-passwordless-kavenegar-0.1.0.tar.gz

Download URL auth-passwordless-kavenegar-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f1b590ed4b33664cc071c39ecd519cac904bbe63e5acf6d5ecd4e6a4dfc9b188
BLAKE2b-256 checksum
How to use checksums
b612f6784eea04c72fc4398e736138b63b45d513c030f161aad76f55e9d2c478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Security for auth-passwordless-kavenegar 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

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