I was trying to integrate OpenAPI 3.0 in my existing springboot restpai application. So far I can configure the openapi-with oAuth2 by using this code snippet.
@Bean
public OpenAPI customOpenAPI() {
OAuthFlow oAuthFlowObject = new OAuthFlow();
oAuthFlowObject
.setAuthorizationUrl("https://<my-domain>.auth.us-east-2.amazoncognito.com/oauth2/authorize");
oAuthFlowObject.setRefreshUrl("https://<my-domain>.auth.us-east-2.amazoncognito.com/oauth2/refresh");
oAuthFlowObject.setTokenUrl("https://<my-domain>.auth.us-east-2.amazoncognito.com/oauth2/token");
OAuthFlows oAuthFlows = new OAuthFlows();
oAuthFlows.authorizationCode(oAuthFlowObject);
return new OpenAPI()
.components(new Components()
.addSecuritySchemes("oauth2", new SecurityScheme().in(SecurityScheme.In.HEADER)
.type(SecurityScheme.Type.OAUTH2)
.flows(oAuthFlows)
.bearerFormat("JWT")
.scheme("bearer")
))
.info(new Info().title("Contact Application API").description(
"This is a sample Spring Boot RESTful service using springdoc-openapi and OpenAPI 3."))
;
}
It seems that I can successfully get the token from the cognito.

But the problem is when I try-out any of the api from swagger-ui, it does not include bearer token.
Is there anything that I'm missing? How could I set the path prefix so that the token will be attached when calling those paths. Also I only wanted to send the "id_token" in the Authorization-bearer header from swagger.


