From 57944cac938ba12078d3e1bccb613dcebb9f1bb0 Mon Sep 17 00:00:00 2001 From: Christopher Ormaza Date: Wed, 11 Dec 2024 15:39:47 -0500 Subject: [PATCH] [18.0][FIX] fastapi, use new authenticate signature and dict answer --- fastapi/dependencies.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fastapi/dependencies.py b/fastapi/dependencies.py index 5978a136..16226bf2 100644 --- a/fastapi/dependencies.py +++ b/fastapi/dependencies.py @@ -114,14 +114,20 @@ def basic_auth_user( username = credential.username password = credential.password try: - uid = ( + response = ( env["res.users"] .sudo() .authenticate( - db=env.cr.dbname, login=username, password=password, user_agent_env=None + db=env.cr.dbname, + credential={ + "type": "password", + "login": username, + "password": password, + }, + user_agent_env=None, ) ) - return env["res.users"].browse(uid) + return env["res.users"].browse(response.get("uid")) except AccessDenied as ad: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED,