apiflask / apiflask

A lightweight Python web API framework.

Home Page:https://apiflask.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support authorization for swwager ui (same as rapidoc, elements)

duchuyvp opened this issue · comments

When I use legacy swagger-ui, I see it allow me to put a header for Authorization. When I back to APIFlask, I didn't see it, and also can't find where to config. Am I wrong or APIFlask doesn't support it yet?
Legacy swagger-ui has "Authorize" button to edit header

Legacy swagger-ui has "Authorize" button to edit header

I found the solution. I need to add config for attribute "security_schemes" when init the APIFlask app

  app.security_schemes = [
      'ApiKeyAuth': {
          'type': 'apiKey',
          'in': 'header',
          'name': 'X-API-Key'
      }
  ]