Make sure to reuse same client secrets between runs.

This commit is contained in:
Antoine Nguyen
2025-11-07 16:09:51 +01:00
parent 2121cfe267
commit 7a38a535f8
4 changed files with 24 additions and 6 deletions

View File

@@ -13,7 +13,6 @@ import stat
import string
import subprocess
import sys
import uuid
from . import config_dict_template
from .compatibility_matrix import APP_INCOMPATIBILITY
@@ -515,14 +514,13 @@ def validate_backup_path(path: str, silent_mode: bool):
return backup_path
def create_oauth2_app(app_name: str, client_id: str, config) -> tuple[str, str]:
def create_oauth2_app(app_name: str, client_id: str, client_secret: str, config) -> tuple[str, str]:
"""Create a application for Oauth2 authentication."""
# FIXME: how can we check that application already exists ?
venv_path = config.get("modoboa", "venv_path")
python_path = os.path.join(venv_path, "bin", "python")
instance_path = config.get("modoboa", "instance_path")
script_path = os.path.join(instance_path, "manage.py")
client_secret = str(uuid.uuid4())
cmd = (
f"{python_path} {script_path} createapplication "
f"--name={app_name} --skip-authorization "