Announcement Announcement Module
Collapse
No announcement yet.
LinkedIn - getting user email Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LinkedIn - getting user email

    Hi,

    I use Spring Social for connect to Facebook and LinkedIn. I need to get user's email because I store the connections in database using JDBCUsersConnectionRepository. When I connect to LinkedIn and get email, it returns null instead. Only first and last name are returned correctly.

    Code:
     @Override
    public String execute(Connection<?> connection) {
        UserProfile profile = connection.fetchUserProfile();
    
        SocialUser user = new SocialUser(profile.getEmail(),
                profile.getFirstName(), profile.getLastName());
    ...
    (It is an implementation of ConnectionSingUp interface). For Facebook it works without an issue. I want to ask, how can I get user's email from LinkedIn.

    I will appreciate your advices.

  • #2
    It is not possible to get user's email address from LinkedIn: http://developer.linkedin.com/thread/3265

    Comment


    • #3
      No exactly correct..
      in the old linkedin terms you couldn't.. in the new ones you actually can, but you need to authenticate differently and request different permissions (including user email). AFAIK, spring-social-linkedin doesn't support that yet.


      HTH
      Yoni

      Comment


      • #4
        Originally posted by yonimoses View Post
        No exactly correct..
        in the old linkedin terms you couldn't.. in the new ones you actually can, but you need to authenticate differently and request different permissions (including user email). AFAIK, spring-social-linkedin doesn't support that yet.
        Thanks for the correction. This issue is has been a major annoyance in one project of mine. Now I just have to wait that support for this is added to spring-social-linkedin

        Comment


        • #5
          What Yoni said is correct. At one time, you couldn't get email, but now LinkedIn is doing an odd hybrid of OAuth 1.0a along with OAuth2-style scoped permissions. If you ask for "r_emailaddress" permission in the scope parameter during authorization, you can get the email address.

          But Yoni is also correct in saying that this is not yet supported. It's something that I've had on a backburner for awhile now, but I've got higher priority items to address first (specifically, Spring Social/Spring Security integration, automatic token renewal, etc).

          To address this, there's probably more to do than just add it back to the LinkedIn API binding. We'll also need to make sure that Spring Social Core's OAuth 1.0a will support non-standard authorization parameters so that the scope parameter can be sent. I'm reluctant to directly support the scope parameter in OAuth 1.0a code, because scope isn't a standard parameter. But I'm open to supporting arbitrary parameters, of which scope could be one.

          Hang tight and I'll get to it. Of course, if someone reading this is interested in helping out, I always welcome pull requests.

          Comment


          • #6
            Pinging to register my interest for this feature to be added...

            Comment


            • #7
              Hi,

              I actually don't mind trying to add it...

              habuma, I'm guessing I'll need to start here ?

              https://github.com/SpringSource/spri...i/Contributing

              Comment


              • #8
                Yoni: Yes, that's a good place to start. To sum it up, though: You fork the project, make your changes, submit a pull request, and sign the individual contributor license. At some point, I review that code, provide feedback to you, and once we're both satisfied I merge it.

                Be aware that I am picky about things like code style (must match the existing style of other Spring Social code) and unit tests. If you have small style or testing mishaps, I will be happy to fix them during my review. But for bigger infractions I will ask you to fix.

                Note that I wouldn't address this by just supporting "scope". Instead, I would seek an elegant way to supply *any* arbitrary parameters to the authorization URL. That way this doesn't just solve the scope problem for LinkedIn, but solves the bigger problem of how to support proprietary parameters in non-standard OAuth implementations.

                Comment


                • #9
                  FWIW, I've created https://jira.springsource.org/browse/SOCIAL-349 to track this effort and provide a place for continued discussion around the issue. You're welcome to continue discussion in this thread, but any technical discussion surrounding a solution would be best captured as comments to the issue itself.

                  Comment


                  • #10
                    Cool.

                    I'll start within the next few days.

                    (why gradle builds ?!!? )

                    Comment

                    Working...
                    X