Repository navigation
Description
Please verify that this bug has NOT been raised before.
- I checked and didn't find a similar issue
Describe the bug*
I've configured SSO using Zitadel/Open ID Connect using the config file, and now when coming back from the IDP i get redirected to the login page with a 401 error on /api/auth/v1/auth/session endpoint. There's no logs even at "TRACE" level and I can't figure out at which stage it fails.
Steps to Reproduce
Add openid configuration to the config.yaml
social_backends:
- 'allauth.socialaccount.providers.openid_connect'
social_providers:
openid_connect:
APPS:
- provider_id: Zitadel
name: Zitadel
client_id: '-----'
settings:
fetch_userinfo: false
oauth_pkce_enabled: true
server_url: 'https://auth.------.com' Enabled relevant SSO Flags
Expected behaviour
Should be authenticated
Deployment Method
None
Version Information
InvenTree-Version: 1.1.5
Django Version: 4.2.26
Commit Hash: c09fb48
Commit Date: 2025-11-22
Commit Branch: null
Database: django.db.backends.postgresql
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-6.17.2-1-pve-x86_64-with-glibc2.41
Installer: DOC
Active plugins: [{"name":"InvenTreeBarcode","slug":"inventreebarcode","version":"2.1.0"},{"name":"BOM Exporter","slug":"bom-exporter","version":"1.1.0"},{"name":"InvenTree Exporter","slug":"inventree-exporter","version":"1.0.0"},{"name":"Part Parameter Exporter","slug":"parameter-exporter","version":"1.0.0"},{"name":"InvenTreeEmailNotifications","slug":"inventree-email-notification","version":"1.0.0"},{"name":"InvenTreeUINotifications","slug":"inventree-ui-notification","version":"1.0.0"},{"name":"InvenTreeCurrencyExchange","slug":"inventreecurrencyexchange","version":"1.0.0"},{"name":"InvenTreeMachines","slug":"inventree-machines","version":"1.0.0"},{"name":"InvenTreeLabel","slug":"inventreelabel","version":"1.1.0"},{"name":"InvenTreeLabelMachine","slug":"inventreelabelmachine","version":"1.0.0"}]
Try to reproduce on the demo site
I did not try to reproduce
Is the bug reproducible on the demo site?
Not reproducible
Relevant log output
2025-11-25T23:46:20.416608000Z 2025-11-25 15:46:20,416 INFO {'request': 'GET /api/auth/v1/auth/session', 'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0', 'event': 'request_started', 'user_id': None, 'request_id': '1beb935e-330e-4797-8b7a-f85f2784d2b8', 'ip': '192.168.1.70', 'timestamp': '2025-11-25T23:46:20.415996Z', 'logger': 'django_structlog.middlewares.request', 'level': 'info'}
2025-11-25T23:46:20.420678000Z 2025-11-25T23:46:20.420316Z [warning ] request_finished [django_structlog.middlewares.request] code=401 ip=192.168.1.70 request='GET /api/auth/v1/auth/session' request_id=1beb935e-330e-4797-8b7a-f85f2784d2b8 user_id=None
2025-11-25T23:46:20.420813000Z 2025-11-25 15:46:20,420 WARNING {'code': 401, 'request': 'GET /api/auth/v1/auth/session', 'event': 'request_finished', 'user_id': None, 'request_id': '1beb935e-330e-4797-8b7a-f85f2784d2b8', 'ip': '192.168.1.70', 'timestamp': '2025-11-25T23:46:20.420316Z', 'logger': 'django_structlog.middlewares.request', 'level': 'warning'}
2025-11-25T23:46:20.421771000Z 2025-11-25 15:46:20,421 WARNING Unauthorized: /api/auth/v1/auth/session
Activity
vsviridov commentedon Nov 27, 2025
I've configured an application via admin backend, and it exhibits the same issue. No logs in the system point me to any place in particular.
znibb commentedon Dec 1, 2025
I'm believe I'm having the same issue, although I am trying to configure the backend and provider via docker environment variables. No matter what version of the config I try I can't make Inventree show a "Sign in with SSO" button on the login screen which (according to ChatGPT) could mean that the OpenID backend is never loaded, possibly due to missing social-auth-core and social-auth-app-django packages. This might just be the AI hallucinating but it's where I am at so far.
matmair commentedon Dec 30, 2025
@vsviridov it looks like the user is not authenticated. If I had to guess that could be because the exaisting account is not associated with the OIDC identity. Maybe try activating SSO registration.
@znibb please do not waste maintainer time with AI slop guessing. InvenTree uses django-allauth, as stated by the docs https://docs.inventree.org/en/stable/settings/SSO/
bunkmate5127 commentedon Jan 9, 2026
I hit the same thing... my primary symptom after tearing my hair out trying to figure this out is that no SSO button for login appears no matter what I do.
I've boiled it down to django not including
openid_connect, onlyopenid:These are all the things installed in the current
stabledocker:Note there is:
allauth.socialaccount.providers.openid, but there is notallauth.socialaccount.providers.openid_connect. These are different things:https://docs.allauth.org/en/dev/socialaccount/providers/openid_connect.html (current, OIDC)
https://docs.allauth.org/en/dev/socialaccount/providers/openid.html (old, obsolete)
The documentation sorely needs some first-party example of a working OIDC implementation.
matmair commentedon Jan 9, 2026
Please provide more information about the setups @bunkmate5127 - this is not enough to replicate.
OpenID and OIDC are different protocols with different audiences. InvenTree only loads the providers that are configured (via INVENTREE_SOCIAL_BACKENDS).
znibb commentedon Jan 10, 2026
@bunkmate5127 My issue was with having no clue how the configuration options for django-allauth were to be set from the context of docker compose. Here's what I ended up with that works for me:
I'm using Traefik as a reverse-proxy using Authentik as the Identity Provider (links are to the repos with the compose files I'm using.
Here's my notes for how I configured Authentik and Inventree to allow OIDC: link
Here's my Inventree docker compose file: link
One key element here is the line "INVENTREE_SOCIAL_BACKENDS=allauth.socialaccount.providers.openid_connect" in
.envthat enables selecting "OpenID Connect" under SOCIAL APPLICATIONS in Inventree.Inventree is an amazing platform with a lot of powerful potential, kudos to @matmair and all the other contributors and maintainers. Sorry about the "AI slop" in my initial post, it was a product of me being at my wit's end due to the aforementioned lack of examples of how to configure django-allauth through the scope of docker compose.
p-fruck commentedon Jan 19, 2026
I think there is another issue with the same question
I've been running inventree with SSO for quite some time now but have never been able to fully configure SSO through the environment, I always had to use the django admin UI.
My only environment based SSO config is the following:
INVENTREE_EMAIL_HOST=localhost # https://github.com/inventree/InvenTree/issues/4553 INVENTREE_SOCIAL_BACKENDS=allauth.socialaccount.providers.openid_connectMaybe throw away the config.yaml or environment variables related to social providers and only use the database config (through django admin ui)
plaes commentedon Jan 21, 2026
It might be that you're missing the client_secret:
vsviridov commentedon Jan 21, 2026
8 remaining items
matmair commentedon May 19, 2026
@mylesagray has enableling LOGIN_ENABLE_REG provided any further infos?
mylesagray commentedon May 19, 2026
stv0g commentedon Jun 13, 2026
I have the same issue.
github-actions commentedon Aug 13, 2026
This issue seems stale. Please react to show this is still important.
jcpage573 commentedon Aug 26, 2026
I think the issue is here — on 1.5.2 (Entra ID / Microsoft provider, not Zitadel, so this looks provider-agnostic — it's a frontend gap, not an OIDC-specific issue).
After a new user completes SSO auth, django-allauth correctly parks a pending
SocialLoginin the session and reports it viaGET /api/auth/v1/auth/session:{"status": 401, "data": {"flows": [{"id": "provider_signup", "provider": {...}, "is_pending": true}]}, "meta": {"is_authenticated": false}}checkLoginState()insrc/frontend/src/functions/auth.tsx(invoked by the/logged-inpage right after the OAuth callback) only branches on "authenticated" vs "not authenticated" — it never inspectsflowsfor a pendingprovider_signup, unlike the MFA flows (MfaAuthenticate/MfaTrust), which are explicitly handled in the same file. So it just redirects to/login, with no error shown, and the account is never finalized.There doesn't seem to be an existing client-side path to complete it either:
ApiEndpoints.tsxhas no entry forauth/v1/auth/provider/signup(the completion endpoint), and there's no reference toprovider_signupanywhere insrc/frontendbesides the enum declaration inlib/types/Auth.tsx. I verified server-side that POSTing to that endpoint directly does work (returns a normal validation error asking forusername), so this looks like a missing frontend handler rather than a backend/config issue.Repro: enable SSO +
LOGIN_ENABLE_SSO_REG, sign in as a user with no existing InvenTree account. Confirmed on the actual1.5.2tag (commitf15e35c), not justmaster.(Investigated with the help of Claude Code.)
SchrodingersGat commentedon Aug 29, 2026
All, please review the proposed changes incoming in #12739