Search code examples
spring-socialspring-sessionspring-social-twitter

Can you have multiple HttpSessionStrategy?


I would like to have a header based HttpSessionStrategy as listed below however Spring Social seems to want to store the social token on the session. When it is redirected back to the application no x-auth-header is specified so a new session is created and the token is lost.

Can we have still have the HeaderSessionStrategy with the CookieSessionStrategy as a fallback?

What is the best way to handle this?

@Bean
public HttpSessionStrategy httpSessionStrategy() {
  return new HeaderHttpSessionStrategy(); 
}

Solution

  • Here is what you want. SmartHttpSessionStrategy