# Issue with ACCOUNT\_EMAIL\_VERIFICATION\_BY\_CODE\_ENABLED: Mandatory verification error despite correct settings

**URL:** <https://forum.djangoproject.com/t/issue-with-account-email-verification-by-code-enabled-mandatory-verification-error-despite-correct-settings/45030>\
**Category:** Packages\
**Created:** [April 30, 2026, 6:39pm UTC](https://forum.djangoproject.com/t/issue-with-account-email-verification-by-code-enabled-mandatory-verification-error-despite-correct-settings/45030 "2026-04-30T18:39:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl3ehindTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/xl3ehindtim/32/27603_2.png) [@xl3ehindTim](https://forum.djangoproject.com/u/xl3ehindTim)\
**Post date:** [April 30, 2026, 6:39pm UTC](https://forum.djangoproject.com/t/issue-with-account-email-verification-by-code-enabled-mandatory-verification-error-despite-correct-settings/45030/1 "2026-04-30T18:39:11Z")

</div>

Hi everyone,

I am trying to implement a headless flow in `django-allauth` using email verification with a code (instead of a link). However, I’m running into a configuration error that I can’t seem to bypass.

Despite having my settings configured as requested by the documentation, I receive the following error during startup/validation:

> `allauth.account.errors.ImproperlyConfigured: ACCOUNT_EMAIL_VERIFICATION_BY_CODE_ENABLED requires ACCOUNT_EMAIL_VERIFICATION = 'mandatory'`

In my `settings.py`, I have defined the following:

```python
# Allauth settings
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_EMAIL_VERIFICATION_BY_CODE_ENABLED = True

ALLAUTH_HEADLESS_ONLY = True

```

I’ve tried:

1. Double-checking for typos in the variable names.

2. Moving the settings higher/lower in the `settings.py` file to ensure no overrides are happening.

3. Verifying that I am using the latest version of `django-allauth`.

It seems like the validation logic is not “seeing” the `mandatory` string correctly, or perhaps there is a specific interaction with the headless setup that I’m missing.
