From fea87d09dcf08f014c17b813d35b90cc892ca05c Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Fri, 17 Nov 2023 12:48:49 +0530 Subject: [PATCH] fix: call auth hooks before raising error --- frappe/auth.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/auth.py b/frappe/auth.py index 4b53e76533..65e1fe8fac 100644 --- a/frappe/auth.py +++ b/frappe/auth.py @@ -571,6 +571,7 @@ def validate_auth(): authorization_header = frappe.get_request_header("Authorization", "").split(" ") if len(authorization_header) == 2: + validate_auth_via_hooks() validate_oauth(authorization_header) validate_auth_via_api_keys(authorization_header) @@ -579,8 +580,6 @@ def validate_auth(): if frappe.session.user in ("", "Guest"): raise frappe.AuthenticationError - validate_auth_via_hooks() - def validate_oauth(authorization_header): """ @@ -621,7 +620,7 @@ def validate_oauth(authorization_header): frappe.set_user(frappe.db.get_value("OAuth Bearer Token", token, "user")) frappe.local.form_dict = form_dict except AttributeError: - raise frappe.AuthenticationError + pass def validate_auth_via_api_keys(authorization_header):