Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong HTTP status when bearer token is expired #7530

Open
barredterra opened this issue May 21, 2019 · 1 comment
Open

Wrong HTTP status when bearer token is expired #7530

barredterra opened this issue May 21, 2019 · 1 comment

Comments

@barredterra
Copy link
Collaborator

How to reproduce

Error

Frappe responds with HTTP 403 Forbidden and the following data:

{
        "exc": [
            "Traceback (most recent call last):",
            "File 'home/frappe/frappe-bench/apps/frappe/frappe/app.py', line 66",
            "in application response = frappe.api.handle()",
            "File 'home/frappe/frappe-bench/apps/frappe/frappe/api.py', line 56",
            "in handle return frappe.handler.handle()",
            "File 'home/frappe/frappe-bench/apps/frappe/frappe/handler.py', line 21",
            "in handle data = execute_cmd(cmd)",
            "File '/home/frappe/frappe-bench/apps/frappe/frappe/handler.py', line 54",
            "in execute_cmd is_whitelisted(method)",
            "File '/home/frappe/frappe-bench/apps/frappe/frappe/handler.py', line 64",
            "in is_whitelisted raise frappe.PermissionError('Not Allowed, {0}'.format(method))",
            "PermissionError: Not Allowed, <function get_logged_user at 0x7f9c027a9c08>"
        ],
        "_server_messages": [
            {
                "message": "Not permitted"
            }
        ]
}

403 means that a new authentication would not make any difference, access would still be denied. However, this is not the case here.

Correct behavior

Frappe should respond with HTTP 401 Unauthorized because the token is only expired, but it is still possible to refresh it.

@indrawow-archive
Copy link

Same here, should with 401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants