Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.springframework.web.client.HttpClientErrorException: 403 Forbidden #2

Open
yasikmondal opened this issue Jan 16, 2019 · 0 comments

Comments

@yasikmondal
Copy link

Hi
After running this project I am getting the below error while hitting to http://localhost:9090/google-oauth2-spring/

11:53:10.864 [http-nio-9090-exec-2] DEBUG o.s.security.web.FilterChainProxy – / at position 1 of 11 in additional filter chain; firing Filter: ‘WebAsyncManagerIntegrationFilter’
11:53:10.864 [http-nio-9090-exec-2] DEBUG o.s.security.web.FilterChainProxy – / at position 2 of 11 in additional filter chain; firing Filter: ‘SecurityContextPersistenceFilter’
11:53:10.865 [http-nio-9090-exec-2] DEBUG o.s.security.web.FilterChainProxy – / at position 3 of 11 in additional filter chain; firing Filter: ‘HeaderWriterFilter’
11:53:10.865 [http-nio-9090-exec-2] DEBUG o.s.s.w.h.writers.HstsHeaderWriter – Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@6b62811e
11:53:10.865 [http-nio-9090-exec-2] DEBUG o.s.security.web.FilterChainProxy – / at position 4 of 11 in additional filter chain; firing Filter: ‘LogoutFilter’
11:53:10.865 [http-nio-9090-exec-2] DEBUG o.s.s.w.u.m.AntPathRequestMatcher – Checking match of request : ‘/’; against ‘/logout’
11:53:10.865 [http-nio-9090-exec-2] DEBUG o.s.security.web.FilterChainProxy – / at position 5 of 11 in additional filter chain; firing Filter: ‘OAuth2AuthenticationProcessingFilter’
11:53:10.866 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – Created GET request for “https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=ya29.GmCTBq4dQN7lxg17HlJ5BWsACPm8lvhsPW4hWKP5gSkc9NB6jTMezejTa_p6QRyzUyO0San-AV7pBYhS3owrxSPBL67iaTI6_IGYHkFKuJFj6i-6ZAC3kGVaxUmOXPkMwDM”
11:53:10.866 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – Setting request Accept header to [application/json, application/+json]
11:53:12.743 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – GET request for “https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=ya29.GmCTBq4dQN7lxg17HlJ5BWsACPm8lvhsPW4hWKP5gSkc9NB6jTMezejTa_p6QRyzUyO0San-AV7pBYhS3owrxSPBL67iaTI6_IGYHkFKuJFj6i-6ZAC3kGVaxUmOXPkMwDM” resulted in 200 (OK)
11:53:12.748 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – Reading [interface java.util.Map] as “application/json;charset=UTF-8” using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@5bbb606a]
11:53:13.052 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – Created GET request for “https://www.googleapis.com/plus/v1/people/me”
11:53:13.052 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – Setting request Accept header to [application/json, application/
+json]
11:53:14.463 [http-nio-9090-exec-2] DEBUG o.s.web.client.RestTemplate – GET request for “https://www.googleapis.com/plus/v1/people/me” resulted in 403 (Forbidden); invoking error handler
11:53:14.481 [http-nio-9090-exec-2] DEBUG o.s.s.w.c.SecurityContextPersistenceFilter – SecurityContextHolder now cleared, as request processing completed
Jan 16, 2019 11:53:14 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/google-oauth2-spring] threw exception
org.springframework.web.client.HttpClientErrorException: 403 Forbidden
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498)
at com.arnoldgalovics.api.oauth.GoogleTokenServices.getUserInfo(GoogleTokenServices.java:72)
at com.arnoldgalovics.api.oauth.GoogleTokenServices.getAuthenticationToken(GoogleTokenServices.java:62)
at com.arnoldgalovics.api.oauth.GoogleTokenServices.getAuthentication(GoogleTokenServices.java:57)
at com.arnoldgalovics.api.oauth.GoogleTokenServices.loadAuthentication(GoogleTokenServices.java:51)
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager.authenticate(OAuth2AuthenticationManager.java:83)
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant