Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3918

Nelmio API doc area and bearer token with symfony 4

$
0
0

I have API in Symfony 4. I added NelmioApiDocBundle to my project, but i have problem with my docs. This is my configuration:packages\nelmio_api_doc.yaml

nelmio_api_doc:    documentation:        #        schemes: [http, https]        info:            title: Symfony JWT API            description: Symfony JWT API docs            version: 1.0.0        securityDefinitions:            Bearer:                type: apiKey                description: 'Authorization: Bearer {jwt}'                name: Authorization                in: header        security:            - Bearer: []    areas: # to filter documented areas        default:            path_patterns:                - ^/api(?!/doc$) # Accepts routes under /api except /api/doc

config\routes.yaml

# Expose your documentation as JSON swagger compliantapp.swagger_ui:    path: /api/doc    methods: GET    defaults: { _controller: nelmio_api_doc.controller.swagger_ui }

This i my swagger ui screen:enter image description here

I have controller: SpeakerController, HomeController, How can I make each controller a separate area and the rest in default? i.e. SpeakerController in area Speaker, HomeController in area Home etc ..

My next problem is that I have an API protected by a bearer token, when I click Authorize in the swagger, I will add the current jwt token and I want to request it, in response I get:

{"code": 401,"message": "JWT Token not found"}

In postman i don't have problem:enter image description here


Viewing all articles
Browse latest Browse all 3918

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>