Skip to content

Instantly share code, notes, and snippets.

@DennisXie
Last active February 24, 2022 09:50
Show Gist options
  • Save DennisXie/e478c9b66007d5f23df2b8fd2be71f22 to your computer and use it in GitHub Desktop.
Save DennisXie/e478c9b66007d5f23df2b8fd2be71f22 to your computer and use it in GitHub Desktop.
spring security authorization_request_not_found
When using Spring Security to implement an OAuth login process.You may got
a authorization_request_not_found error when you deploy multiple application
instances. This is caused by that the spring security saved the authorization
requests in memory. Just implementing a AuthorizationRequestRepository to share
the requests can solve this problem. Such as HttpCookieOAuth2AuthorizationRequestRepository,
RedisCookieOAuth2AuthorizationRequestRepository.
reference:
docs: https://docs.spring.io/spring-security/site/docs/5.0.7.RELEASE/reference/html/oauth2login-advanced.html#oauth2login-advanced-authorization-request-repository
related source code: https://github.com/spring-projects/spring-security/blob/ea352e1c59507d70920246b2b0df35c31ef3ef0f/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java
sample code: https://snippets.cacher.io/snippet/45fbb8ccaab624e1cade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment