diff --git a/CTFd/api/__init__.py b/CTFd/api/__init__.py index aa508468..c2a4d50e 100644 --- a/CTFd/api/__init__.py +++ b/CTFd/api/__init__.py @@ -26,7 +26,26 @@ from CTFd.api.v1.unlocks import unlocks_namespace from CTFd.api.v1.users import users_namespace api = Blueprint("api", __name__, url_prefix="/api/v1") -CTFd_API_v1 = Api(api, version="v1", doc=current_app.config.get("SWAGGER_UI_ENDPOINT")) +CTFd_API_v1 = Api( + api, + version="v1", + doc=current_app.config.get("SWAGGER_UI_ENDPOINT"), + authorizations={ + "AccessToken": { + "type": "apiKey", + "in": "header", + "name": "Authorization", + "description": "Generate access token in the settings page of your user account.", + }, + "ContentType": { + "type": "apiKey", + "in": "header", + "name": "Content-Type", + "description": "Must be set to `application/json`", + }, + }, + security=["AccessToken", "ContentType"], +) CTFd_API_v1.schema_model("APISimpleErrorResponse", APISimpleErrorResponse.schema()) CTFd_API_v1.schema_model(