Skip to content

Login with superuser account fails because it is treated as registration attempt #12209

Closed

Description

@MartinHenselHLL

Deployment Method

  • Installer
  • Docker Development
  • Docker Production
  • Bare metal Development
  • Bare metal Production
  • Digital Ocean image
  • Other (please provide a link Steps to Reproduce

Describe the problem*

I am trying inventree for the first time and deployed a completely new docker-compose install on Ubuntu-24 following the directions given in https://docs.inventree.org/en/stable/start/docker_install/#docker-installation

After the initial db setup via invoke update all containers come up as expected. However all login attempts using the superuser account created either in the .env file or via the invoke superuser fail. The inventree-server container reports INVE-W12: Signup attempt blocked, because registration is disabled via setting LOGIN_ENABLE_REG. which should not matter, when attempting a sign-in with an existing account?

Steps to Reproduce

  1. Follow docs https://docs.inventree.org/en/stable/start/docker_install/#docker-installation to deploy with docker-compose.
  2. Run db initialization with docker compose run --rm inventree-server invoke update.
  3. Create a superuser account by either
    a. Setting up the necessary variables in the .env file (INVENTREE_ADMIN_USER, INVENTREE_ADMIN_PASSWORD, INVENTREE_ADMIN_EMAIL).
    b. Running the superuser command docker compose run inventree-server invoke superuser.
  4. Deploy the full container stack with docker compose up -d
  5. Navigate to the instance landing page
  6. Try to log in with the superuser credentails.
  7. The frontend shows Error 403: Check your input and try again.
  8. The backend logs can be found below.

Running the docker compose run inventree-server invoke superuser command again confirms, that the superuser account exists.

Relevant log output

inventree-server  | 2026-06-19T11:23:46.378685Z [warning  ] INVE-W12: Signup attempt blocked, because registration is disabled via setting LOGIN_ENABLE_REG. [inventree] ip=##.###.###.## request_id=bee88131-5414-4ca9-ba92-31086f4aac7f user_id=None
inventree-server  | 2026-06-19 13:23:46,378 WARNING {'event': 'INVE-W12: Signup attempt blocked, because registration is disabled via setting LOGIN_ENABLE_REG.', 'request_id': 'bee88131-5414-4ca9-ba92-31086f4aac7f', 'user_id': None, 'ip': '##.###.###.##', 'timestamp': '2026-06-19T11:23:46.378685Z', 'logger': 'inventree', 'level': 'warning'}
inventree-server  | 2026-06-19T11:23:46.402048Z [warning  ] request_finished               [django_structlog.middlewares.request] code=401 ip=##.###.###.## request='GET /api/auth/v1/auth/session' request_id=bee88131-5414-4ca9-ba92-31086f4aac7f user_id=None
inventree-server  | 2026-06-19 13:23:46,402 WARNING {'code': 401, 'request': 'GET /api/auth/v1/auth/session', 'event': 'request_finished', 'request_id': 'bee88131-5414-4ca9-ba92-31086f4aac7f', 'user_id': None, 'ip': '##.###.###.##', 'timestamp': '2026-06-19T11:23:46.402048Z', 'logger': 'django_structlog.middlewares.request', 'level': 'warning'}
inventree-server  | 2026-06-19 13:23:46,403 WARNING Unauthorized: /api/auth/v1/auth/session
inventree-server  | ##.###.###.## - - [19/Jun/2026:13:23:46 +0200] "GET /api/auth/v1/auth/session HTTP/1.1" 401 120 "http://inventree.localhost/web/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0"
inventree-server  | 2026-06-19 13:23:46,454 WARNING Forbidden (CSRF cookie not set.): /api/auth/v1/auth/login
inventree-server  | 2026-06-19T11:23:46.455142Z [warning  ] request_finished               [django_structlog.middlewares.request] code=403 ip=##.###.###.## request='POST /api/auth/v1/auth/login' request_id=5c0c7039-2e7f-46f1-8201-be30d43eb695 user_id=None
inventree-server  | 2026-06-19 13:23:46,455 WARNING {'code': 403, 'request': 'POST /api/auth/v1/auth/login', 'event': 'request_finished', 'request_id': '5c0c7039-2e7f-46f1-8201-be30d43eb695', 'user_id': None, 'ip': '##.###.###.##', 'timestamp': '2026-06-19T11:23:46.455142Z', 'logger': 'django_structlog.middlewares.request', 'level': 'warning'}
inventree-server  | ##.###.###.## - - [19/Jun/2026:13:23:46 +0200] "POST /api/auth/v1/auth/login HTTP/1.1" 403 1773 "http://inventree.localhost/web/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0"

Activity

  1. added
    question
    setup
    triage:not-checked
    on Jun 19, 2026
  2. SchrodingersGat commented on Jun 20, 2026

    @SchrodingersGat
    Member

    @MartinHenselHLL the INVW-W12 warning here is a red-herrring.

    This is the real reason you cannot login:

    inventree-server  | 2026-06-19 13:23:46,454 WARNING Forbidden (CSRF cookie not set.): /api/auth/v1/auth/login
    

    The CSRF configuration is not setup correctly - refer to the following:

    Have you configured your site URL to match the URL you are accessing the instance from?

  3. added
    bug
    and removed
    question
    triage:not-checked
    on Jun 20, 2026
  4. added theissue type on Jun 20, 2026
  5. added this to the 1.4.0 milestone on Jun 20, 2026
  6. removed
    bug
    on Jun 20, 2026
  7. removed theissue type on Jun 20, 2026
  8. removed this from the 1.4.0 milestone on Jun 20, 2026
  9. added this to the 1.4.0 milestone on Jun 20, 2026
  10. modified the milestones: 1.4.0, 1.3.7 on Jun 21, 2026
  11. MartinHenselHLL commented on Jun 22, 2026

    @MartinHenselHLL
    Author

    @MartinHenselHLL the INVW-W12 warning here is a red-herrring.

    This is the real reason you cannot login:

    inventree-server  | 2026-06-19 13:23:46,454 WARNING Forbidden (CSRF cookie not set.): /api/auth/v1/auth/login
    

    The CSRF configuration is not setup correctly - refer to the following:

    * https://docs.inventree.org/en/stable/start/config/#server-access
    
    * https://docs.inventree.org/en/stable/faq/
    
    * https://docs.inventree.org/en/stable/troubleshooting/
    

    Have you configured your site URL to match the URL you are accessing the instance from?

    @SchrodingersGat Thanks for the quick answer.

    • The INVENTREE_SITE_URL isconfigured and exactly the URL I access the login page from.
    • All other site-access settings were left on their defaults, which should allow CORS from the URL INVENTREE_SITE_URL.
    • After your reply, I tested setting INVENTREE_CORS_ORIGIN_ALLOW_ALL=True to reduce the chance of CORS rejection: No change in behavior.

    In the end it seems that a wrong CORS cookie or some other invalid part got stuck in my cache. The problems seem to be solved after a complete cache flush.

    Thank you for the help @SchrodingersGat !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationquestionsetup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions