Announcement Announcement Module
Collapse
No announcement yet.
SocialAuthentication Token after authenticated with facebook Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SocialAuthentication Token after authenticated with facebook

    After forwarded to facebook page to key in username and password, i'm redirected back to SocialAuthenticationProvider. May i know is SocialAuthenticationToken below correct?


    SocialAuthenticationToken.connectionData.displayNa me= null
    SocialAuthenticationToken.connectionData.imagerl= Yes got value
    SocialAuthenticationToken.connectionData.profileUr l= Yes got value
    SocialAuthenticationToken.connectionData.providerI d = Yes got value
    SocialAuthenticationToken.connectionData.providerU serId= Yes got value

    why displayName can be null? when doing request, i requtested scope "email", where can i get it from socialAuthenticationToken ?

  • #2
    The display name is set from the Facebook user's "username". Not all FB users have a username, but some do. Mine, for instance, is "habuma" and Mark Zuckerberg's is "zuck". But some people have not bothered setting their username (they can still login with their email address)...in those cases, the displayName (which is set from the username in FacebookAdapter.java) will be null.

    You can't get the email address from the socialAuthenticationToken. The ConnectionData that the token carries is a minimal profile data and the idea is for it to carry some common user data that most/all providers will make available. Since not all providers will make email available (Twitter, for instance, does not expose their user's email address), it's not one of the values captured in the connection data.

    You can, however, use the Facebook API binding (Facebook/FacebookTemplate) to fetch the user's full profile data and from that get the email. Assuming you have an instance of the Facebook interface, it'd be something like this:

    Code:
    FacebookProfile profile = facebook.userOperations().getUserProfile();
    String email = profile.getEmail();

    Comment


    • #3
      The display name is set from the Facebook user's "username". Not all FB users have a username, but some do. Mine, for instance, is "habuma" and Mark Zuckerberg's is "zuck". But some people have not bothered setting their username (they can still login with their email address)...in those cases, the displayName (which is set from the username in FacebookAdapter.java) will be null.

      You can't get the email address from the socialAuthenticationToken. The ConnectionData that the token carries is a minimal profile data and the idea is for it to carry some common user data that most/all providers will make available. Since not all providers will make email available (Twitter, for instance, does not expose their user's email address), it's not one of the values captured in the connection data.

      You can, however, use the Facebook API binding (Facebook/FacebookTemplate) to fetch the user's full profile data and from that get the email. Assuming you have an instance of the Facebook interface, it'd be something like this:

      Code:
      FacebookProfile profile = facebook.userOperations().getUserProfile();
      String email = profile.getEmail();

      Comment

      Working...
      X