Search code examples
linkedin-apilaravel-socialite

linkedin cat get vanity name


Hi I am trying to get the profile url for the user that is logging in from linkedin(the login part has been nailed), but according to the documentation I need to request for the vanity name from the api.

So I requested it like follows:

https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,vanityName,profilePicture(displayImage~:playableStreams))

to no avail, note that there was no access denied or error, and it returns some of the data, but no vanityName. Example returnes json with deleted parts

{
"firstName": ...
},
"lastName": ...
},
"profilePicture":...,
"id":"M-jljLc2ue"
}

I am using the following docs as a reference

https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api?context=linkedin/consumer/context.

If of any use, I am using the laravel socialite packages as a base


Solution

  • You can't get the vanityName or public profile URL in v2, unless, you have the permit approved by LinkedIn. They also discourage if you apply for the partner program to get the vanityName.

    Please check the links & quotes below.

    https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api?context=linkedin/consumer/context

    The use of this API is restricted to those developers approved by LinkedIn and subject to applicable data restrictions in their agreements.

    https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api-v1-migration

    Please do not apply to a partner program like the Marketing Developer Platform if you are seeking access to member profile data that is not made available via the new “Lite Profile” permission. Access to partner programs is appropriate for select use cases only, and all other requests for access will be rejected.

    https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

    List of LinkedIn v1 API permissions (old)

    • r_basicprofile
    • r_emailaddress
    • w_share
    • rw_company_admin

    List of LinkedIn v2 API permissions (new)

    • r_liteprofile (replaces r_basicprofile)
    • r_emailaddress
    • w_member_social (replaces w_share)