Please take the time to search the repository, if your question has already been asked or answered.
Currently am working with Spring boot 2.0.1 with Swagger 2.8.0 version, I've followed below sample documentation completely . I could see the ApiKey for adding the token but when am giving request from the Swagger UI. it is not sending the Apikey through Header. How to resolve this issue.
find the attached screen shots.


I think you need to upgrade to 2.9.0
Hi @dilipkrish I've Restructure the modified Code in below attached manner, now it's started working as expected.
@Configuration
public class SwaggerConfiguration extends WebMvcConfigurationSupport {
@Bean
public Docket appApi() {
AuthorizationScope[] authScopes = new AuthorizationScope[1];
authScopes[0] = new AuthorizationScopeBuilder().scope("global").description("full access").build();
SecurityReference securityReference = SecurityReference.builder().reference("Authorization-Key")
.scopes(authScopes).build();
ArrayList<SecurityContext> securityContexts = newArrayList(
SecurityContext.builder().securityReferences(newArrayList(securityReference)).build());
return new Docket(DocumentationType.SWAGGER_2)
.securitySchemes(newArrayList(new ApiKey("Authorization-Key", "Authorization", "header")))
.securityContexts(securityContexts).apiInfo(apiInfo()).select().build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Swagger API Security REST API")
.description("\"Swagger API Security REST API\"").version("1.0.0").build();
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
Hi, how to add a description on the popup swagger UI like used bearer token format etc..
Most helpful comment
Hi @dilipkrish I've Restructure the modified Code in below attached manner, now it's started working as expected.