title: How to store OAuth2 session into database and share it between Spring Boot servers
body: <p>I want to create a solution based on that tutorial: <a href="https://www.baeldung.com/rest-api-spring-oauth2-angular" rel="nofollow noreferrer">https://www.baeldung.com/rest-api-spring-oauth2-angular</a></p>
  
  <p>But it's not clear for me how several Spring Boot servers behind load balanced can share the same token session.</p>
  
  <p>With session cookie the session data can be stored in MySQL and of server goes offline the session will be resumed by another Spring Boot server.</p>
  
  <p>Can we have with OAuth2 the same setup with shared database so that the session data can be shared and switching of severs can be completely transparent for the end users?</p>