Announcement Announcement Module
Collapse
No announcement yet.
After signIn - IF signIn was with Facebook...(decent approach?) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • After signIn - IF signIn was with Facebook...(decent approach?)

    I'm wondering what the best way to handle this is.

    Ideally I think it might be nice if the ProviderSignInController had interceptor hooks like the ConnectController has (preSignin / postSignin ?)

    I'm looking for the best way to handle doing "facebook" things if the user signed in with Facebook after the Facebook auth stuff all takes place. (In our case we have to update the facebook profile data that we store in our internal DBs if the updatedDate has changed.)

    For now it looks like the easiest place to do this would be in my SignInAdapter implementation, so I'm wondering if this is a decent approach?

    Code:
    public String signIn(String memberID, Connection<?> connection, NativeWebRequest nativeWebRequest) {
         socialSignInUtils.signin(memberID);
    
         String providerId = connection.getKey().getProviderId();   
         if ("facebook".equalsIgnoreCase(providerId)) {
             //handle all our specific facebook stuff ?
         }
    	 
    }

  • #2
    What you show is one way of doing it...especially if the Facebook-specific thing is signin-related (it's in a signIn() method, after all). Also, depending on when you want to inject this custom Facebook-specific behavior, another option is to subclass ProviderSignInController and override the oauth2Callback() method.

    There aren't really any good subclassing hook methods in ProviderSignInController, but there probably should be. Or, as you said, interceptors might be a good idea, too--it has been asked for quite a bit, so perhaps it's time to start thinking about it again.

    Comment


    • #3
      Originally posted by habuma View Post
      --it has been asked for quite a bit, so perhaps it's time to start thinking about it again.
      If you end up in there and adding interceptor hooks, one for 'postDisconnect' would be useful also.

      In our case, if a user disconnects from a Facebook provider, I'd like to wipe some tables of data where we are storing things, so I'm attempting to work on this now in my overriden ConnectController with something like...

      Code:
      @Override
      public RedirectView removeConnections(@PathVariable String providerId, NativeWebRequest request) {
          //clean up our custom facebook storage where we store facebook profile info
          if (providerId.equalsIgnoreCase(SocialConstants.PROVIDER_FACEBOOK)) {
              //do cleanup
          }
          return super.removeConnections(providerId, request);
      }
      Probably a "postDisconnect" hook where the above could be done within an interceptor would be a cleaner approach.

      Comment

      Working...
      X