I’m trying to authenticate from a flutter app and I’m trying to build out the authentication flow when I realized that when a request with an expired cookie is made, the server doesn’t respond 403 status code but a 500 internal server error, indicating that the pipe has been broken, is there anyway to get around this so that when I get a 403 my app can act accordingly and log the user out?
where is the stack trace of the issue?
Here it is:
Traceback (most recent call last):
File “/home/systems/frappe-bench/apps/frappe/frappe/app.py”, line 110, in application
response = frappe.api.handle(request)
File “/home/systems/frappe-bench/apps/frappe/frappe/api/init.py”, line 49, in handle
data = endpoint(**arguments)
File “/home/systems/frappe-bench/apps/frappe/frappe/api/v1.py”, line 36, in handle_rpc_call
return frappe.handler.handle()
File “/home/systems/frappe-bench/apps/frappe/frappe/handler.py”, line 49, in handle
data = execute_cmd(cmd)
File “/home/systems/frappe-bench/apps/frappe/frappe/handler.py”, line 82, in execute_cmd
is_whitelisted(method)
File “/home/systems/frappe-bench/apps/frappe/frappe/init.py”, line 843, in is_whitelisted
throw(msg, PermissionError, title=“Method Not Allowed”)
File “/home/systems/frappe-bench/apps/frappe/frappe/init.py”, line 589, in throw
msgprint(
File “/home/systems/frappe-bench/apps/frappe/frappe/init.py”, line 561, in msgprint
_raise_exception()
File “/home/systems/frappe-bench/apps/frappe/frappe/init.py”, line 512, in _raise_exception
raise exc
frappe.exceptions.PermissionError:
You are not permitted to access this resource.
Function frappe.auth.get_logged_user is not whitelisted.During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/systems/frappe-bench/apps/frappe/frappe/middlewares.py”, line 16, in call
return super().call(environ, start_response)
File “/home/systems/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py”, line 249, in call
return self.app(environ, start_response)
File “/home/systems/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py”, line 249, in call
return self.app(environ, start_response)
File “/home/systems/frappe-bench/apps/frappe/frappe/app.py”, line 74, in application
app(environ, start_response),
File “/home/systems/frappe-bench/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py”, line 189, in application
resp = f(*args[:-2] + (request,))
File “/home/systems/frappe-bench/apps/frappe/frappe/app.py”, line 128, in application
response = handle_exception(e)
File “/home/systems/frappe-bench/apps/frappe/frappe/app.py”, line 329, in handle_exception
response = frappe.utils.response.report_error(http_status_code)
File “/home/systems/frappe-bench/apps/frappe/frappe/utils/response.py”, line 47, in report_error
frappe.errprint(traceback)
File “/home/systems/frappe-bench/apps/frappe/frappe/init.py”, line 444, in errprint
print(msg)
BrokenPipeError: [Errno 32] Broken pipe
Write an issue on the GitHub with more details