Joseph Adam
Joseph Adam

Reputation: 1642

does swagger support JWT authentication?

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

Upvotes: 1

Views: 911

Answers (1)

mahdi hoseyni
mahdi hoseyni

Reputation: 63

this works for me:

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

Upvotes: 1

Related Questions