External and BrowsableAPI Authentication
This README.md assumes that you already set up a Logto app for your front-end application.
First at all, use the command python manage.py migrate to change the user model.
You will now have to add the logto urls:
url_patterns = [
path('auth/', include('django_logto.urls')),
]
To use External Authentication and BrowsableAPI authentication, you need to change the default Authenticationclass in your settings. \
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
"django_logto.authentication.LogtoAuthentication",
),
}
You need to set in settings.py:
LOGTO_AUDIENCE="**your_api_url**" #(e.g. : http://localhost:8000)
LOGTO_JWKS_URIS="**<logto_url>/oidc/jwks**"
LOGTO_ENDPOINT="**your_logto_url**"
LOGTO_API_CLIENT_ID="**your_TraditionalWebApp_id**"
LOGTO_API_SECRET="**your_TraditionalWebApp_secret**"
LOGTO_API_REDIRECT_URI="**<your_api_url>/auth/callback/**"
LOGTO_CALLBACK_URI="**<your_api_url>/api/**" #(this one can be changed, depending on your needs. For more information, you can refer to the Logto documentation )
For BrowsableAPI authentication, you can authenticate threw /auth/signin
DjangoAdmin Authentication
Set the AUTH_USER_MODEL and AUTHENTICATION_BACKENDS in settings: \
AUTHENTICATION_BACKENDS = ["django_logto.logto_backend.LogtoBackend"]
AUTH_USER_MODEL = "django_logto.LogtoUser"
Add the related Machine-To-Machine Logto app environment variables:
LOGTO_ADMIN_CLIENT_ID="**<your_m2m_app_id>**"
LOGTO_ADMIN_CLIENT_SECRET="**<your_m2m_app_secret>**"
This package accesses to Logto ManagementAPI to retrieve the actual connected user's roles.
You will need to give your M2M app the permission to access to ManagementAPI (don't forget to set the role as "Machine-to-machine app role"):
https://docs.logto.io/docs/recipes/rbac/manage-permissions-and-roles/#create-and-define-a-new-role
This package also expects (by default) to receive an "admin" role from the managementAPI to give the user the right to access the admin console by creating a role with name="admin" (don't forget to set the role as "User role").
You can override it by defining another admin tags in settings.py: \
LOGTO_ADMIN_TAG=["<1st_admin_tag>","<2nd_admin_tag>","etc"]
Metadata
Release files for django-logto 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-logto-1.0.4.tar.gz | 10.7 kB | Without provenance | Details for django-logto-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_logto-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for django_logto-1.0.4-py3-none-any.whl |
Total release size: 23.1 kB
Release files / django-logto-1.0.4.tar.gz
| Download URL | django-logto-1.0.4.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea6d7b3c3bab9dbf35af0317f5296ffc7f452b121792708b56a4fa710c4df119
|
|
BLAKE2b-256 checksum How to use checksums |
bffa34ba5fdb26c1fa3b108e0cefd4d0bde722140b2eff3b22b06567caa2b415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Release files / django_logto-1.0.4-py3-none-any.whl
| Download URL | django_logto-1.0.4-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fb8c869e8c3dab3eb1d5b19eeac1f57b67a0187131370cba0598f7ef018de99
|
|
BLAKE2b-256 checksum How to use checksums |
0f1fec3e531da010e32f8a99a3803e8ca3a33609851fa90249153fcf30c185dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Security for django-logto 1.0.4
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.