grails-spring-security-core icon indicating copy to clipboard operation
grails-spring-security-core copied to clipboard

Oauth2 Google Access blocked: This app’s request is invalid

Open pangeaos opened this issue 1 year ago • 0 comments

I have been using this plugin for years but only using credentials. I want to configure the oauth2 login now. I'm having this error when I try to use oauth2 Google. Is this plugin using the latest updated of Google API?

Login URL: http://localhost:8080/oauth/authenticate/google Callback URL: http://localhost:8080/oauth/callback/google

My configuration: Grails version: 6.2.0 Java: 11.0.23 implementation("org.grails.plugins:spring-security-core:6.1.1") implementation("org.grails.plugins:spring-security-rest:3.0.1")

Screenshot 2024-08-17 at 11 13 10 AM

Screenshot 2024-08-17 at 11 16 44 AM

The logs:

2024-08-17 11:10:33.963 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Securing GET /oauth/authenticate/google 2024-08-17 11:10:33.971 DEBUG --- [nio-8080-exec-1] .w.f.GrailsAnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'GrailsAnonymousAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=__grails.anonymous.user__, Password=[PROTECTED], Enabled=false, AccountNonExpired=false, credentialsNonExpired=false, AccountNonLocked=false, Granted Authorities=[ROLE_ANONYMOUS]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=null], Granted Authorities=[ROLE_ANONYMOUS]]' 2024-08-17 11:10:33.982 DEBUG --- [nio-8080-exec-1] g.p.s.r.token.bearer.BearerTokenReader : Looking for bearer token in Authorization header, query string or Form-Encoded body parameter 2024-08-17 11:10:33.983 DEBUG --- [nio-8080-exec-1] g.p.s.r.token.bearer.BearerTokenReader : No token found 2024-08-17 11:10:33.983 DEBUG --- [nio-8080-exec-1] g.p.s.r.token.bearer.BearerTokenReader : Token: null 2024-08-17 11:10:33.984 DEBUG --- [nio-8080-exec-1] g.p.s.rest.RestTokenValidationFilter : Token not found 2024-08-17 11:10:33.984 DEBUG --- [nio-8080-exec-1] g.p.s.rest.RestTokenValidationFilter : Request does not contain any token. Letting it continue through the filter chain 2024-08-17 11:10:34.048 DEBUG --- [nio-8080-exec-1] o.s.s.a.h.RoleHierarchyImpl : getReachableGrantedAuthorities() - From the roles [ROLE_ANONYMOUS] one can reach [ROLE_ANONYMOUS] in zero or more steps. 2024-08-17 11:10:34.053 DEBUG --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Authorized filter invocation [GET /oauth/authenticate/google] with attributes [permitAll] 2024-08-17 11:10:34.054 DEBUG --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Secured GET /oauth/authenticate/google 2024-08-17 11:10:34.054 DEBUG --- [nio-8080-exec-1] r.SpringSecurityRestFilterRequestMatcher : Actual URI is /oauth/authenticate/google; endpoint URL is /api/logout 2024-08-17 11:10:34.199 DEBUG --- [nio-8080-exec-1] g.p.s.rest.RestOauthService : Creating OAuth client for provider: google 2024-08-17 11:10:34.200 WARN --- [nio-8080-exec-1] org.grails.config.NavigableMap : Accessing config key 'client' through dot notation is deprecated, and it will be removed in a future release. Use 'config.getProperty(key, targetClass)' instead. 2024-08-17 11:10:34.217 DEBUG --- [nio-8080-exec-1] g.p.s.rest.RestOauthService : Callback URL is: http://localhost:8080/oauth/callback/google 2024-08-17 11:10:34.246 DEBUG --- [nio-8080-exec-1] o.p.o.r.OAuth20RedirectActionBuilder : save sessionState: 7b6d968578 2024-08-17 11:10:34.253 DEBUG --- [nio-8080-exec-1] o.p.o.r.OAuth20RedirectActionBuilder : authorizationUrl: https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=XXXXXXX&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth%2Fcallback%2Fgoogle%3Fclient_name%3DGoogle2Client&scope=profile%20email&state=7b6d968578 2024-08-17 11:10:34.256 DEBUG --- [nio-8080-exec-1] g.p.s.rest.RestOauthController : Redirecting to https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=XXXXXXXX&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Foauth%2Fcallback%2Fgoogle%3Fclient_name%3DGoogle2Client&scope=profile%20email&state=7b6d968578

pangeaos avatar Aug 17 '24 17:08 pangeaos