Announcement Announcement Module
Collapse
No announcement yet.
Unable to access session varibale "social.addConnection.duplicate" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to access session varibale "social.addConnection.duplicate"

    Hi all,

    I've been trying to access the session variable "social.addConnection.duplicate" in my controllers but it seems it is not present in the session. I verified that in the ConnectController it gets set. What I am trying to achieve is to provide a message to the user if there is already a Social connection present for a particular Facebook account.

    Thanks in advance.

  • #2
    You're right that ConnectController sets that in the session, but you may not have noticed that ConnectController also removes it from the session (in the processFlash() method). It sets it upon encountering the duplicate, then redirects to the connect status URL, and then it deletes it.

    It's only put into session scope because request scoped attributes won't survive redirects. Therefore, ConnectController manages its own flash-scope so that the attribute will be around after redirecting back to the connection status page. If this were using Spring 3.1, I could rely on Spring 3.1's support for flash-scope instead...but since I have to also support Spring 3.0, which doesn't have flash-scope, I had to handle it all within ConnectController.

    But I see your point...you should be able to somehow display a message regarding the duplicate connection to the user upon arriving at the connection status page. By the time the view is displayed, the flash scope will have been cleared out. Hmmm....I have created https://jira.springsource.org/browse/SOCIAL-297 to address this.

    Comment


    • #3
      Hi,

      Thank you for the clarification. As a workaround when the user attempts to link a Facebook account we append a parameter 'q' to /connect/facebook?q=fb-link. An interceptor is written for the pattern /connect/facebook to check if q is present, if so a session variable is kept to indicate that the user started the process of authenticating with Facebook. Once the user comes to the origination page on the application we check if the q parameter is present and queries the UserConnection table to see if the account has been linked against the user. If not it is assumed that it failed due to a duplicate connection. It's not the best approach but it works.

      Looking forward to seeing https://jira.springsource.org/browse/SOCIAL-297 being resolved.

      Thanks.

      Comment

      Working...
      X