| 1 |
Installation |
| 2 |
============ |
| 3 |
|
| 4 |
In order to use the headless functionality you need to install the |
| 5 |
``headless`` extra as follows:: |
| 6 |
|
| 7 |
pip install "django-allauth[headless]" |
| 8 |
|
| 9 |
In your ``settings.py``, include:: |
| 10 |
|
| 11 |
INSTALLED_APPS = [ |
| 12 |
... |
| 13 |
|
| 14 |
# Required |
| 15 |
'allauth', |
| 16 |
'allauth.account', |
| 17 |
'allauth.headless', |
| 18 |
|
| 19 |
# Optional |
| 20 |
'allauth.socialaccount', |
| 21 |
'allauth.mfa', |
| 22 |
'allauth.usersessions', |
| 23 |
|
| 24 |
... |
| 25 |
] |
| 26 |
|
| 27 |
# These are the URLs to be implemented by your single-page application. |
| 28 |
HEADLESS_FRONTEND_URLS = { |
| 29 |
"account_confirm_email": "https://app.project.org/account/verify-email/{key}", |
| 30 |
"account_reset_password_from_key": "https://app.org/account/password/reset/key/{key}", |
| 31 |
"account_signup": "https://app.org/account/signup", |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
Your project ``urls.py`` should include:: |
| 36 |
|
| 37 |
urlpatterns = [ |
| 38 |
# Even when using headless, the third-party provider endpoints are stil |
| 39 |
# needed for handling e.g. the OAuth handshake. The account views |
| 40 |
# can be disabled using `HEADLESS_ONLY = True`. |
| 41 |
path("accounts/", include("allauth.urls")), |
| 42 |
|
| 43 |
# Include the API endpoints: |
| 44 |
path("_allauth/", include("allauth.headless.urls")), |
| 45 |
] |