InvenTree
Sign in to the InvenTree inventory management system with Pocket ID.
Requirements
Section titled “Requirements”- InvenTree
- Pocket ID on HTTPS, reachable at
https://<pocketid-domain.tld> - InvenTree server on HTTPS, reachable at
https://<inventree-domain.tld>
Create the client in Pocket ID
Section titled “Create the client in Pocket ID”- In Pocket ID, open Administration → OIDC Clients and click Add OIDC Client.
- Enter a name such as
InvenTreeand add the callback URLhttps://<inventree-domain.tld>/accounts/<provider-id>/login/callback/. - Click Create and copy the Client ID and the Client secret. The client secret is only shown once.
- On the client’s General tab, set Client Launch URL to
https://<inventree-domain.tld>and turn on PKCE, then click Save. - On the client’s Access tab, select the groups that may sign in under Allowed User Groups, or choose All Users.
Choose a name for <provider-id> (e.g. pocket-id) and use the same value as provider_id in the configuration below.
Configure InvenTree
Section titled “Configure InvenTree”The following is the minimal configuration needed to set up Pocket ID OIDC with InvenTree.
Option A: Configuration file (recommended)
Section titled “Option A: Configuration file (recommended)”- Add the following to your
config.yaml, replacing values from Step 6:
social_backends: - 'allauth.socialaccount.providers.openid_connect'
social_providers: openid_connect: APPS: - provider_id: pocket-id name: Pocket ID client_id: '<your_client_id_from_above>' secret: '<your_client_secret_from_above>' settings: server_url: 'https://<pocketid-domain.tld>' fetch_userinfo: true oauth_pkce_enabled: true token_auth_method: client_secret_postOption B: Environment variables
Section titled “Option B: Environment variables”- Add the following lines to your InvenTree
.env, replacing the values from Step 7:Terminal window INVENTREE_SOCIAL_BACKENDS=allauth.socialaccount.providers.openid_connectINVENTREE_SOCIAL_PROVIDERS={"openid_connect": {"SERVERS": [{"id": "pocket-id", "name": "Pocket ID", "server_url": "https://<pocketid-domain.tld>", "APP": {"client_id": "<your_client_id_from_above>", "secret": "<your_client_secret_from_above>"}}]}} - Save and restart the InvenTree docker-compose stack.
Enable SSO in InvenTree
Section titled “Enable SSO in InvenTree”Once InvenTree is restarted, enable SSO via the admin UI:
- Sign in as an admin.
- Navigate to System Settings → Authentication.
- Enable the following options:
- Enable SSO
- Enable SSO registration
- Auto-fill SSO users
Note: If Email Required is enabled but SMTP is not configured, SSO login may fail during user registration. Add the following to use the console email backend as a workaround:
Terminal window INVENTREE_EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend