I'm trying to integrate a Spring Cloud Gateway (with WebFlux) and Amazon AWS Cognito. I spent almost a week and it is still not working. I want to authenticate users in a cognito user pool using authorization_code grant type.
Here is my settings:
spring:
security:
oauth2:
client:
registration:
cognito:
client-id: xxxxx
client-secret: xxxx
scope: openid
redirectUriTemplate: "http://localhost:9090/login/oauth2/code/cognito"
clientName: xxxx-client
provider:
cognito:
issuerUri: https://cognito-idp.us-east-2.amazonaws.com/xxxxxxxxx
usernameAttribute: cognito:username
Here is my pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-security</artifactId>
</dependency>
One of the issues I'm facing is :
{"code":"BadRequest","message":"The server did not understand the operation that was requested.","type":"client"}
And some other random issues. I was never able to see Cognito's login screen. If you can provide some sample application it will he helpful.