Announcement Announcement Module
No announcement yet.
Now got connected the redirected but how to get user information into a form Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Now got connected the redirected but how to get user information into a form

    So I must be moving forward. Not exactly the way I expected but getting somewhere.

    So after the connection is made to Twitter or Facebook. It sends the callback and then the ConnectController forwards to the facebookConnect.jsp or the twitterConnect.jsp. In those pages I now have a registration form. I want to prepopulate it with the user data from the social network, but in our UserDetails object. I have implemented the ConnectionSignUp interface, but don't see how to hook that into the model of the xxxConnect.jsp pages.

    I guess I could have an onload function that does a get to my server to get the Connection and user data with ajax. That way I won't have to use the Spring form taglibs


    Last edited by bytor99999; Feb 6th, 2013, 05:34 PM. Reason: additional info

  • #2
    If you look at the showcase examples, you'll see that SignupController uses the ProviderSignInUtils.getConnection() method to fetch the pending connection and uses data from that to populate a SignupForm that it places in the request. On the JSP it pulls that data and populates the form.

    But what you're doing is a bit odd. You're doing a connection via ConnectController and then, after successful connection, you are taking them to a page where you have a registration form. That's very cart-before-the-horse.

    ConnectController is for creating connections between an *existing* local user and their remove provider account. If you're walking a user through the ConnectController flow, then it's assumed that the user already exists and is already signed into your application. If not, then what is being connected? What's the local user in the connection?

    To create connections for new users as a part of the registration process, ProviderSignInController is your guy. PSIC will attempt to authenticate an existing user if that user has previously connected to the provider. But if there's no matching connection, it will create a connection, but not persist it (that's the pending connection I mentioned in the first paragraph). Then it will forward to an app-defined registration page. After successful registration, you can user ProviderSignInUtils to complete the pending connection.


    • #3
      "That's very cart-before-the-horse."

      That's funny. I just said that about someting yesterday. Can't remember where.

      OK, so Connect is only for connecting someone's social account to an account they already have on our website. I thought it was the other way around. And that the SignInController was just for later when the user wants to sign in to their account on our website, but only through entering their social credentials instead of their username/password on our website.

      See, I told you I was confused.

      Ok here are two screen shots. We have two drop downs in our Nav. One for registering (short version of registration) and one for login. As you can see in the drop downs I have "register with" and "login with" buttons for FB and Twitter.

      Reason why we have a short version of registration, is that in the end there is a lot of detail we need from the user, and rather then them having to fill all it out first and them possibly never signing up.

      Attachment Attachment

      Attached Files


      • #4
        So the "register with" was using the ConnectController, and I was going to use the SignupController for the "login with"

        So what you are saying is that the SignupController should be used with just login, and if the user doesn't exist in our user table, then they go through the dance.

        Later if they want to add other social accounts to their user account, in the Account edit page we can use the ConnectController.

        No wonder there was no data saved in the userconnection table after I had gone through the dance.




        • #5
          But here is another thing that doesn't make sense.

          What if the user has an account on our website, hasn't connected their social to that account. Then tries the login with XXX, and accepts it. How will the social account get connected to the website user account, because the username (Spring Security) is going to be different than the userId from the social network. I guess I could try matching email addresses. But where would that code go?