keycloak-spring-cloud-gateway-and-resource-server icon indicating copy to clipboard operation
keycloak-spring-cloud-gateway-and-resource-server copied to clipboard

gateway cannot handle /authorized url after I change keycloak to spring authorization server

Open uniquejava opened this issue 3 years ago • 1 comments
trafficstars

Hello, I followed your tutorial and everything worked well.

I'd just like to replace keycloak with the new spring authorization server so that I can do more customization.

However I cannot get the job done.

  1. Trying to access the resource server(api) via gateway, gateway redirect me to IdP(spring authorization server)
  2. Login in successfully and agree on the consent page
  3. After that, the gateway cannot process the redirect uri http://127.0.0.1:8080/authorized?code=!

Looks like OAuth2AuthorizationCodeGrantWebFilter in the spring cloud gateway not work, it cannot understand the callback url.

Do you have any working Spring Authorization Server + Spring Cloud Gateway(as oauth2 client) example. Thank you very much.

uniquejava avatar Jun 18 '22 05:06 uniquejava

Hey @uniquejava ,

I think the redirect URL has to be of this format "{baseUrl}/{action}/oauth2/code/{registrationId}"; you can have a look at this class here: CommonOAuth2Provider. Try changing it. see if works.

I haven't used spring authorization server.. So not sure about this.

amrutprabhu avatar Jul 23 '22 16:07 amrutprabhu