LinkedIn API not providing the user URN

88 views Asked by At

am trying to use linkedin API to make users share content from our platform to their profiles in LinkedIn, in the Documentation the API requires a user URN in the request body. But when i follow how to get it i see a legacy APIs shares/userId that seems do not work anymore ( They don't even provide an id to test the legacy API in the response)
I have this scopes email, openid, profile, r_ads, r_events, r_learningdata, r_liteprofile, r_marketing_leadgen_automation, w_member_social

I saw many people having the same problem but there is no response on the issue or any clarification

Endpoints a tried

  1. https://api.linkedin.com/v2/userinfo

    Response:
{
    "sub": "XXX-XXXX",
    "email_verified": true,
    "name": "XXXX XXXXX",
    "locale": {
        "country": "FR",
        "language": "fr"
    },
    "given_name": "XXXX",
    "family_name": "XXXX",
    "email": "[email protected]",
    "picture": "XXXXXXX"
}
  1. https://api.linkedin.com/v2/me

    Response:.
{
    "localizedLastName": "XXXX",
    "profilePicture": {
        "displayImage": "XXXXX"
    },
    "firstName": {
        "localized": {
            "fr_FR": "XXXX"
        },
        "preferredLocale": {
            "country": "FR",
            "language": "fr"
        }
    },
    "lastName": {
        "localized": {
            "fr_FR": "XXXX"
        },
        "preferredLocale": {
            "country": "FR",
            "language": "fr"
        }
    },
    "id": "XXX-XXXX",
    "localizedFirstName": "XXXX"
}

No user URN returned in both

1

There are 1 answers

0
shing On

The URN refers to the ID returned from the https://api.linkedin.com/v2/me response OR the sub field from https://api.linkedin.com/v2/userinfo.