Results 1 to 2 of 2

Thread: How to remember source page while connecting with Spring Social?

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Location
    Software Nirvana Land
    Posts
    30

    Unhappy 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

    e.g.

    Code:
    @Override
    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. #2
    Join Date
    Jan 2008
    Posts
    248

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •