fix: Enhance the error message of the connected app authorization.

Error were "Invalid state". The reason was user who created the token. So we've added a little bit more context here.

(cherry picked from commit 4ad55b98c28d4c342808d166e7c124b89729607e)
This commit is contained in:
Türker Tunalı 2024-09-04 19:24:42 +03:00 committed by Mergify
parent 8aed92d569
commit 733edd2ffd

View file

@ -194,7 +194,7 @@ def callback(code=None, state=None):
token_cache = frappe.get_doc("Token Cache", connected_app.name + "-" + frappe.session.user)
if state != token_cache.state:
frappe.throw(_("Invalid state."))
frappe.throw(_("Invalid state! Check if token is created by the oath user."))
oauth_session = connected_app.get_oauth2_session(init=True)
query_params = connected_app.get_query_params()