mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 22:14:25 +01:00
Document API authentication (#2021)
* Document API authentication and Content-Type header requirement
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user