Search code examples
androidoauth-2.0linkedin-apispring-social-linkedin

How to get profile URL from linkedIn API V2?


How can i get profile URL from linkedIn API V2 (api.linkedin.com/v2)? Requested &scope=r_emailaddress%20r_liteprofile response have only firstname,lastname,id and profile_picture before v2 we were able to find out profile URL from id (example: https://www.linkedin.com/profile/view?id=$ID ) but now this shows profile not found error and doesn't work. i have gone through many links and read LinkedIn documentation but didn't find the right solution moreover i have read on stackoverflow linkedIn don't recommend r_fullprofile permission just for vanity name is this correct ? what should i do to get profile URl from linkedin?


Solution

  • You can't with the scope you mentioned.

    You need to add r_basicprofile to the scope to request the vanityName.

    A few considerations:

    • Your app needs to have the permission r_basicprofile available, you can check that by going here, then select your app, then go to the "Auth" tab, and after check the "Permissions" section.
    • You need to add r_basicprofile to the scope query param
    • Here you can see that you are able to fetch the vanityName property, then all you need to do is concatenate with https://www.linkedin.com/in/ to have the full profile URL as in "https://www.linkedin.com/in/ + vanityName"
    • Linkedin doesn't give r_basicprofile permissions to any app, you need to request it to LinkedIn and they might not give it to you.