{"id":21141,"library":"django-authlib","title":"django-authlib","description":"Authentication utilities for Django, providing reusable views and helpers for OAuth2, SAML, OpenID Connect, and more. Current version 0.17.2, requires Python >=3.9. Released irregularly, maintained by matthiask.","status":"active","version":"0.17.2","language":"python","source_language":"en","source_url":"https://github.com/matthiask/django-authlib/","tags":["django","authentication","oauth2","saml","openid-connect"],"install":[{"cmd":"pip install django-authlib","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for Django framework","package":"django","optional":false},{"reason":"Used for OAuth2 and other HTTP requests","package":"requests","optional":true}],"imports":[{"wrong":"from authlib.views import LoginView","symbol":"LoginView","correct":"from authlib.views import LoginView"}],"quickstart":{"code":"import os\nfrom django.conf import settings\nfrom django.urls import path\nfrom authlib.views import LoginView, LogoutView\n\n# Ensure required settings\nif not settings.configured:\n    settings.configure(\n        DEBUG=True,\n        SECRET_KEY='test-secret',\n        ROOT_URLCONF=__name__,\n        AUTH_USER_MODEL='auth.User',\n        AUTH_TOKEN_URL=os.environ.get('AUTH_TOKEN_URL', 'https://provider/token'),\n        AUTH_CLIENT_ID=os.environ.get('AUTH_CLIENT_ID', 'client-id'),\n        AUTH_CLIENT_SECRET=os.environ.get('AUTH_CLIENT_SECRET', 'secret'),\n    )\n\nurlpatterns = [\n    path('login/', LoginView.as_view(), name='login'),\n    path('logout/', LogoutView.as_view(), name='logout'),\n]\n\nif __name__ == '__main__':\n    from django.core.management import execute_from_command_line\n    execute_from_command_line(['manage.py', 'runserver'])\n","lang":"python","description":"Minimal setup with login/logout views using environment variables for OAuth2 credentials."},"warnings":[{"fix":"Update imports to use authlib.oauth2.OAuth2Client instead of authlib.client.OAuth2Client.","message":"In version 0.17, the OAuth2 client was moved from authlib.client to authlib.oauth2. Old imports will break.","severity":"breaking","affected_versions":">=0.17"},{"fix":"Use django-saml2 or python3-saml instead.","message":"The SAML support in authlib.saml is deprecated in favor of third-party libraries.","severity":"deprecated","affected_versions":">=0.16"},{"fix":"Ensure these settings are defined in Django settings.py or via environment variables.","message":"Setting AUTH_TOKEN_URL, AUTH_CLIENT_ID, and AUTH_CLIENT_SECRET in Django settings is mandatory; missing these will cause runtime errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Create a custom user model or use Django's default auth.User; ensure proper fields are present.","message":"The package does not include migrations; user model must already exist with appropriate fields (e.g., email, username).","severity":"gotcha","affected_versions":"all"},{"fix":"Update URL references in templates or redirects to use the new path.","message":"As of 0.16, the callback URL pattern changed from /auth/callback/ to /auth/complete/. Custom templates may break.","severity":"breaking","affected_versions":">=0.16,<0.17"}],"env_vars":null,"search_vec":"'0.17.2':22 '3.9':25 'authent':4,32 'authlib':3 'connect':17,37 'current':20 'django':2,7,31 'django-authlib':1 'helper':12 'irregular':27 'maintain':28 'matthiask':30 'oauth2':14,33 'openid':16,36 'openid-connect':35 'provid':8 'python':24 'releas':26 'requir':23 'reusabl':9 'saml':15,34 'util':5 'version':21 'view':10","created_at":"2026-04-27T16:58:17.822164+00:00","updated_at":"2026-04-27T16:58:17.822164+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpql4ibnu6/venv/lib/python3.12/site-packages/authlib/views.py\", line 3, in <module>\n    from django import forms\nModuleNotFoundError: No module named 'django'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.17.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"http://github.com/matthiask/django-authlib","docs":null,"changelog":null,"pypi":"https://pypi.org/project/django-authlib/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","auth-security","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}