'Adding a place for JWT Bearer Token to Swagger Documentation in Restx

I'm using the below structure

    authorizations = {
    'apikey': {
        'type': 'apiKey',
        'in': 'header',
        'name': 'X-API-KEY'
    }
}

api = Api(app, authorizations=authorizations)

But in the swagger ui, i'm giving my token directly and getting response

Error: UNAUTHORIZED



Solution 1:[1]

You need to add security parameter in your api initializations.

api = Api(app, authorizations=authorizations, security='apikey')

Don't forget to refresh swagger page.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Agung Wiyono