python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask

Home Page:https://flask-restx.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I manually enter the request header Authorization in the Swagger document

miaokela opened this issue · comments

Ask a question
How do I manually enter the request header Authorization in the Swagger document

Additional context
I need the token to carry when verifying the interface

You need to configure flask-restx Swagger security, see the docs here: https://flask-restx.readthedocs.io/en/latest/swagger.html#documenting-authorizations

There is also a great tutorial for flask-restx that details how to configure JWT like tokens, but it can be used for any authentication scheme in a simialr way: https://aaronluna.dev/series/flask-api-tutorial/part-4/#swagger-ui

image I have implemented the problem of submitting a Token in the request header in the document by using the parser location as the header, along with ns.expect()