Skip to main content

Django OAuth2 authentication backend for Sabiá (Brazil's SUS identity provider)

Project description

django-sabia-auth

PyPI Version PyPI version Tests Coverage Python CI and PyPI Deploy Python Versions Django Versions Django Versions License: MIT

Django OAuth2 authentication backend for Sabiá, Brazil's SUS (Sistema Único de Saúde) identity provider, hosted at login.sabia.ufrn.br.

Installation

pip install django-sabia-auth

Configuration

Add to INSTALLED_APPS and configure settings:

INSTALLED_APPS = [
    ...
    "django_sabia_auth",
]

AUTHENTICATION_BACKENDS = [
    "django_sabia_auth.backends.SabiaAuthBackend",
    "django.contrib.auth.backends.ModelBackend",
]

SABIA_CLIENT_ID = "your-client-id"
SABIA_CLIENT_SECRET = "your-client-secret"
SABIA_REDIRECT_URI = "https://yourapp.example.com/auth/sabia/callback/"
SABIA_SCOPES = ["cpf", "email"]  # optional, these are the defaults
LOGIN_REDIRECT_URL = "/dashboard/"
LOGIN_URL = "/login/"

URL Setup

# urls.py
from django.urls import path, include

urlpatterns = [
    path("auth/sabia/", include("django_sabia_auth.urls")),
    ...
]

Usage

Add a login button to your template:

<a href="{% url 'sabia_auth:login' %}">Login with Sabiá</a>

Documentation

Full documentation is available in the docs/ directory.

Sabiá Developer Portal

For API credentials, visit the Sabiá developer page.

License

MIT © 2026 kelsoncm

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

django_sabia_auth-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

django_sabia_auth-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_sabia_auth-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_sabia_auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62808b8ee9db59e9392551b3bdd489f282f9189e5774951e13a0f65099467a3e
MD5 a5166aec7b7d39c90d5f95ec13f15c4b
BLAKE2b-256 0977fb0d4e97012b80e7762ef44349566e24cd852d4e2ee761213578a1658430

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sabia_auth-0.1.0.tar.gz:

Publisher: publish.yml on kelsoncm/django-sabia-auth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for django_sabia_auth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8c90e527dbc802a7b9c6bb945d3d3fddf170c976c2f0e2129e2c1f874e10953
MD5 ba1335d60bca17eaea7805a425b70283
BLAKE2b-256 8d81883d63752853d7fc489851f223d5269ed7ca1f11e52f2dbe3bfd9b51463c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sabia_auth-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kelsoncm/django-sabia-auth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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