Skip to content

Need a way to intercept exception to send http 401 #118

@luzik

Description

@luzik

Description

I can't find a way to mix @api.dispatcher.add_method with @jwt_required from flask-jwt-extended

Steps to Reproduce

@api.dispatcher.add_method
@jwt_required
def rpc_test(param: str) -> str:
      return 'mucha %s ' % param

@app.route('/test')
@jwt_required
def test():
     return 'tesss'

Expected behavior: [What you expect to happen]

Unauthorized call for rpc_test return 401 code

Actual behavior: [What actually happens]

Unauthorized call for rpc_test return 200 code with data:
{"error": {"code": -32000, "message": "Server error", "data": {"type": "NoAuthorizationError", "args": ["Missing cookie "access_token_cookie""], "message": "Missing cookie "access_token_cookie""}}, "id": 4, "jsonrpc": "2.0"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions