How to get a prefilled authorization key in swagger with drf-specatular

96 views Asked by At

I use django, drf and drf-spectacular. I create swagger documentation. Some endpoints require authentication. I can authenticate in swagger by pressing authorize and filling in the token.

I would like that this filled in automatically for me. How do I do that?

I tried to add preauthorizeApiKey to my settings, like this:

SPECTACULAR_SETTINGS = {
    'SWAGGER_UI_SETTINGS': {
        'preauthorizeApiKey': 'Token my-secret-token'
    }
}

It doesnt work.

0

There are 0 answers