does swagger support JWT authentication?

720 Views Asked by At

How can I add JWT as an authentication for Swagger? Here is my Swagger Settings:

SWAGGER_SETTINGS = {
    "SECURITY_DEFINITIONS": {
        "JWT": {
            "name": "Authorization",
            "description": "JWT authorization",
            "type": "http",
            "scheme": "bearer",
            "bearerFormat": "JWT",
            "in": "header",
        }
    },
    "USE_SESSION_AUTH": False,
}

I get

Unknown security definition type http

1

There are 1 best solutions below

2
On

this works for me:

SWAGGER_SETTINGS = {
    'SECURITY_DEFINITIONS': {
        "Auth Token eg [Bearer {JWT}]": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}