SilverSight/scripts/configure_homarr_oidc.py
allaun 9f2d4011de feat: Homarr OIDC configured with Authentik SSO
- OIDC provider config inserted into Homarr SQLite database
  (serverSetting key=authentication, provider=Authentik)
- Authentik redirect URIs expanded to include researchstack.info
- Homarr login page now shows OIDC option alongside credentials
- setup/check scripts committed for future maintenance

Access Homarr at https://researchstack.info/ with OIDC login
2026-06-30 05:24:42 -05:00

44 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Configure Homarr OIDC by inserting into the database."""
import sqlite3, json
conn = sqlite3.connect("/home/allaun/.local/share/containers/storage/volumes/homarr-data/_data/db/db.sqlite")
auth_config = {
"json": {
"oidcProviders": [
{
"displayName": "Authentik",
"clientId": "homarr",
"clientSecret": "insecure-homarr-secret-change-me",
"issuer": "http://100.92.88.64:9090/application/o/homarr/",
"discoveryUrl": "http://100.92.88.64:9090/application/o/homarr/.well-known/openid-configuration",
"callbackUrl": "http://homarr.neon.lan:9092/api/auth/callback/authentik",
"enabled": True,
}
],
"providers": ["credentials", "oidc"],
}
}
try:
conn.execute(
"INSERT INTO serverSetting (setting_key, value) VALUES (?, ?)",
("authentication", json.dumps(auth_config)),
)
conn.commit()
print(f"Inserted OIDC config: {json.dumps(auth_config, indent=2)}")
except sqlite3.IntegrityError:
conn.execute(
"UPDATE serverSetting SET value = ? WHERE setting_key = ?",
(json.dumps(auth_config), "authentication"),
)
conn.commit()
print("Updated existing authentication config")
# Verify
row = conn.execute("SELECT value FROM serverSetting WHERE setting_key = 'authentication'").fetchone()
if row:
print(f"\nVerified: {row[0][:200]}")
conn.close()