Swagger/Open Api Specification - Security specification

Hello everyone!

I’m new with Okta and I’ve made a Rest API with Symfony 5 so I’ve implemented the okta oauth that works perfect, now I’m doing the documentation with Swagger, but I don’t know how to implement the oauth in Swagger to try the endpoints from the api docs.

I’ve tried multiple things, one of them this code:

        // packages/nelmio_api_doc.yaml
        nelmio_api_doc:
        documentation:
            info:
              (stuff)
            components:
                securitySchemes:
                    OAuth2:
                        type: oauth2
                        flows:
                            authorizationCode:
                                authorizationUrl: https://(myurl)/oauth2/default
                                tokenUrl: https://(myurl)/oauth2/default/v1/token
                                scopes:
                                    read: Grants read access
                                    write: Grants write access
                                    admin: Grants access to admin operations
            security:
                - OAuth2:
                      - read
                      - write

Symfony does not return any error, but I cant try the endpoints, any suggest pls??