I had the same issue and I found how to fix it.
You can use this to get the user information: https://learn.microsoft.com/es-es/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2#api-request-to-retreive-member-details
The returning json code looks like this:
{
"sub": "782bbtaQ",
"name": "John Doe",
"given_name": "John",
"family_name": "Doe",
"picture": "https://media.licdn-ei.com/dms/image/C5F03AQHqK8v7tB1HCQ/profile-displayphoto-shrink_100_100/0/",
"locale": "en-US",
"email": "[email protected]",
"email_verified": true
}
Here what you want is the "sub" field, that acts like the id to create the urn you need to post. Now you just have to follow the format: e.g - urn:li:person: + sub
One thing I had trouble with was the scope when authenticating the user. Pay attention to the scope required, here you can see what scope is needed: https://learn.microsoft.com/es-es/linkedin/consumer/integrations/self-serve/share-on-linkedin#authenticating-members
I hope you can solve the error!