odigity
odigity

Reputation: 8196

In APIFlask, can auth be used to protect the Swagger endpoints?

I have an APIFlask app that servers Swagger UI and OpenAPI spec endpoints. (/docs and /openapi.json, respectively.)

I have successfully implementer JWT-based Bearer auth to protect my own endpoints, but I don't see any obvious way to protect the auto-generated Swagger UI and OpenAPI spec endpoints.

Suggestions?

Upvotes: 2

Views: 141

Answers (1)

Notscientific Farmer
Notscientific Farmer

Reputation: 153

From version 2.1.0, we can add the auth decorators with the SPEC_DECORATORS or DOCS_DECORATORS configuration.

See more with: https://apiflask.com/openapi/#protect-openapi-endpoints

Upvotes: 2

Related Questions