Skip to content

Authorization on Swagger UI #2911

@lewimuchiri

Description

@lewimuchiri

The bundled Swagger UI does not give an option to authorize requests. Usually, Swagger presents an Authorize button when any request is sequred (as shown in the screenshot below).
When I use Elide Spring Boot starter, and I secure my endpoints, the Swagger UI doesn't present any option to add JWT token.

image

I've also tried adding the 'Authorization' header for every path as follows:

HeaderParameter oauthParam = new HeaderParameter()
                .name("Authorization")
                .type("string")
                .description("OAuth bearer token")
                .required(true);

        SwaggerBuilder builder = new SwaggerBuilder(dictionary, info)
                .withGlobalParameter(oauthParam);

        return builder.build()
                .basePath(settings.getJsonApi().getPath());

Nothing works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions