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-1.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-1.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_sabia_auth-1.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-1.1.0.tar.gz
Algorithm Hash digest
SHA256 622dc693e92cf7cf61c3258692187ce959f5f45a877ad6cd56a2fdf69df412bf
MD5 38235314cb1a0b500176783b2036254f
BLAKE2b-256 6df504192ca2ef8691736eced63efdfa940efbdb8a0908d354a7553183d0e338

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sabia_auth-1.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-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sabia_auth-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 110832375ca112abc04cdabe158a334798df6cc0074a7fbabb8f46ef9807054b
MD5 25dd43a07ba9687b32ddc6de5472a833
BLAKE2b-256 2492c61787301729a056d2afcd51cf6f7d67ad2b8b86e3686b349d90712d8c8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sabia_auth-1.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