Astuce S'authentifier dans le Swagger d'API Platform

Lorsqu'on utilise JWT pour l'authentification dans API Platform, on a besoin d'ajouter ce jeton à nos requêtes pour communiquer avec l'API. API Platform propose un bouton pour faire ça facilement dans Swagger :

Bouton d'authentification dans Swagger

Ce bouton n'apparaît pas par défaut. Il faut l'activer dans la configuration d'API Platform :

# config/package/api_platform.yaml
api_platform:
    swagger:
        api_keys:
            apiKey:
                name: Authorization
                type: header