Announcement Announcement Module
No announcement yet.
How to remember source page while connecting with Spring Social? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to remember source page while connecting with Spring Social?

    I'm successfully using Spring Social to connect to Facebook and Twitter. Currently, if a user clicks on "Connect to Facebook" or "Connect to Twitter", she's taken to the FB or Twitter auth page, authorized and redirected back to my application.

    Here I take things into my hands and redirect the user to her profile by extending ConnectController and overriding the connectedView method


    protected String connectedView(String providerId){
      //Get current user details
      user = userService.getCurrentUser();
      //Redirect to her profile
      return "redirect:/profile/+user.getDisplayName();
    This works fine. But now the problem is, I want to remember the source page from which she pressed the "Connect to Facebook" button (as I've the button on 3 different pages), so that once she's connected she's automatically redirected to her source page.

    Please guide me. I'm stuck.

  • #2
    I use the connect form itself to define extra variables. I then use an interceptor to intercept these variables preConnect and store them in the session and remove them again postConnect. I recommend reading up on the connect interceptors. You could also rely on using iframes to execute the connection process.