from drf_spectacular.extensions import OpenApiAuthenticationExtension class IntegrationTokenAuthenticationScheme(OpenApiAuthenticationExtension): target_class = "apps.common.authentication.IntegrationTokenAuthentication" name = "IntegrationToken" def get_security_definition(self, auto_schema): return { "type": "apiKey", "in": "header", "name": "X-Integration-Token", }