I am building a mobile web app that has the option to login via facebook/twitter. I want the app to remember the login via Spring security's remember me functionality so that the user need to have to login frequently.
I have the parts that will call out to facebook and get the access_token that will identify the user. I can login the user using
SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(principal, credentials, authorities));
I am trying to use similar approach to add remember me functionality by
RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(key, principal, authorities); SecurityContextHolder.getContext().setAuthentication(auth);
While this logs in the user, it does not set the remember me cookie. What am I missing here?
Thanks!