Open
Description
I'm using FlaskApiSpec, but I couldn't make the authorization button appear in swagger ui,
I've tried the following solution but it didn't work,
https://mattfrear.com/2018/07/21/add-an-authorization-header-to-your-swagger-ui-with-swashbuckle-revisited/
here are my config
from flask import Flask, Blueprint
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_apispec import FlaskApiSpec
def create_app(mode='dev', test_configs=None):
app = Flask(__name__)
app.extensions['mode'] = mode
marshmallow_plugin = MarshmallowPlugin()
# Filter the warnins for partial schemas
warnings.filterwarnings("ignore", message="Multiple schemas resolved to the name ")
authorizations = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'X-API-KEY'
}
}
app.config.update({
## flask-apispec
'APISPEC_SPEC': APISpec(
title='DeepCT Notifier Server APIs',
version='v1.0.0',
plugins=[marshmallow_plugin],
openapi_version='2.0',
authorizations=authorizations
),
'APISPEC_SWAGGER_UI_URL': '/api-spec', # Define the api spec route
marshmallow_plugin.converter.add_attribute_function(_enum_to_properties) # Support showing enum on Swagger
docs = FlaskApiSpec(app, document_options=False)
return app
and I also tried put authorizations variables at FlaskApiSpec like FlaskApiSpec(app, document_options=False, authorizations=authorizations). but it ended it is unexpected key word.
Does flask-apispec support to get authorized via button a head of the swagger ui page instead of manually set "Authorization" to Bearer in individual endpoint's headers ?
thanks for helping
Metadata
Metadata
Assignees
Labels
No labels