Skip to main content

A toolkit for handling OAuth with Django Rest Framework

Project description

DRF OAuth Toolkit

drf-oauth-toolkit is a flexible OAuth2 integration library for Django Rest Framework (DRF).

Features

  • Plug-and-play OAuth2 integration for DRF
  • Supports multiple OAuth providers
  • Built-in token management and CSRF protection

Installation

pip install drf-oauth-toolkit

Usage

  1. Add drf_oauth_toolkit to INSTALLED_APPS in your settings.py.
  2. Configure OAuth credentials in your Django settings.
  3. Import and extend the base OAuthServiceBase class for your desired OAuth provider.
from drf_oauth_toolkit.services.base import OAuthServiceBase

class GoogleOAuthService(OAuthServiceBase):
    API_URI_NAME = "google_redirect"
    AUTHORIZATION_URL = "https://accounts.google.com/o/oauth2/auth"
    TOKEN_URL = "https://oauth2.googleapis.com/token"
    USER_INFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo"
    SCOPES = ["openid", "email", "profile"]

Running Tests

pytest

Contributing

Pull requests are welcome. For major changes, please open an issue first.

License

MIT License. See LICENSE for more information.

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

drf_oauth_toolkit-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drf_oauth_toolkit-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file drf_oauth_toolkit-0.1.0.tar.gz.

File metadata

  • Download URL: drf_oauth_toolkit-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0

File hashes

Hashes for drf_oauth_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e415c4bebaf6ae245d376dc0fc9d96efed08bb3715ed2f6a6042114243d5f71e
MD5 569f2b176777559233ca65da6d209df1
BLAKE2b-256 f882cae81858c2245dfaf97ea69b84bba5a60250d05ab78e866c06290107fa7f

See more details on using hashes here.

File details

Details for the file drf_oauth_toolkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: drf_oauth_toolkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.1.0

File hashes

Hashes for drf_oauth_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddd46fa18f76c54a0a1bdfe635473b030867184fb75f0620f6c2565ae40d4c2c
MD5 6918f34a76dc20503a6ad683fbacaeb1
BLAKE2b-256 be6f56ba1f7b8f42e0b315493f8bb6479de9d0af86d5dd2aca07215075758703

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