spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Using spring security oauth2 and oauth2Login on spring cloud gateway

Open rishisc opened this issue 5 years ago • 0 comments

Getting invalid_grant using oauth2login on spring cloud gateway with spring security oauth2 server I have used google client in my oauth2 server where we are using oauth2login to authenicate users using sign in with google. My gateway acts as client for my oauth2 server where we registered all client. After successful login from google in auth server where I get a valid context for authenication. Gateway hits back with /oauth/authorize to get a valid access token. When I debug into gateway OidcAuthorizationCodeReactiveAuthenticationManager where I get code in response which when I hit using Postman it give me access token in response. But when I get response in OAuth2AccessTokenResponseBodyExtractor I get below response with bad request(400).

{
    "error": "invalid_grant",
    "error_description": "Invalid authorization code: csGaUx"
}

Versions: Spring-boot: 2.4.1 Spring-cloud: 2020.0.1

Can you pls help me with above issue is with spring cloud gateway or I need to post this issue in spring security or spring security oauth2?

rishisc avatar Jun 19 '21 16:06 rishisc