LinkedIn OAuth2 not getting email address?

561 views
Skip to first unread message

Gena K

unread,
Nov 4, 2014, 3:17:17 PM11/4/14
to pac4j...@googlegroups.com
New to pac4j but must say that it's been great so far! Thank you for having a good Java sample and docs and keeping this maintained and up to date! I'm using it with Play framework 2.3.6 and Java APIs.

Anyway, I'm having a problem getting the email address in the profile from LinkedIn. On developer's side for LinkedIn API I enabled r_basicprofile, r_contactinfo, and  r_emailaddress. But when I look at the profile values that come back after login (i.e. CommonProfile profile = getUserProfile()), and inspect profile.getEmail() it comes back as null.

Am I missing something?

Jérôme LELEU

unread,
Nov 5, 2014, 9:33:58 AM11/5/14
to Gena K, pac4j...@googlegroups.com
Hi,

Looking at the test: https://github.com/leleuj/pac4j/blob/master/pac4j-oauth/src/test/java/org/pac4j/oauth/client/LinkedIn2ClientIT.java, it seems that the email should be returned. Did you try with: r_fullprofile r_emailaddress r_contactinfo?
Otherwise, turn on your DEBUG logs to see what is returned by LinkedIn?

Thanks.
Best regards,


Jérôme LELEU
Founder of CAS in the cloud: www.casinthecloud.com | Twitter: @leleuj
Chairman of CAS: www.jasig.org/cas | Creator of pac4j: www.pac4j.org

--
You received this message because you are subscribed to the Google Groups "pac4j-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pac4j-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

genachka

unread,
Nov 5, 2014, 12:49:57 PM11/5/14
to pac4j...@googlegroups.com, gena...@gmail.com
Yes, just tried with those all set on as well. I was googling for this and found a few references that state that LinkedIn won't return the email address unless you pay extra for it. Not sure though if it's true?

Also, I found that GitHub and Twitter also don't return the email address. Can others confirm this as normal?

Is profile.id something that I can use that is unique and consistent for each user that logins via social logins?

Jérôme LELEU

unread,
Nov 6, 2014, 4:10:32 AM11/6/14
to genachka, pac4j...@googlegroups.com
Hi,

The getId() method of the user profile returns the unique identifier of the provider (example: 123456). The getTypedId() method returns a unique identifier accross all providers (example: FacebookProfile#123456).

Best regards,

Jérôme LELEU
Founder of CAS in the cloud: www.casinthecloud.com | Twitter: @leleuj
Chairman of CAS: www.jasig.org/cas | Creator of pac4j: www.pac4j.org

Reply all
Reply to author
Forward
0 new messages