Results 1 to 10 of 10

Thread: LinkedIn - getting user email

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Default 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. #2

  3. #3

    Default

    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

  4. #4

    Default

    Quote 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

  5. #5
    Join Date
    Aug 2004
    Posts
    1,097

    Default

    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.
    Craig Walls
    Spring Social Project Lead

  6. #6

    Default

    Pinging to register my interest for this feature to be added...

  7. #7

    Default

    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

  8. #8
    Join Date
    Aug 2004
    Posts
    1,097

    Default

    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.
    Craig Walls
    Spring Social Project Lead

  9. #9
    Join Date
    Aug 2004
    Posts
    1,097

    Default

    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.
    Craig Walls
    Spring Social Project Lead

  10. #10

    Default

    Cool.

    I'll start within the next few days.

    (why gradle builds ?!!? )

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •