My application was sharing the post through api to the url: https://api.linkedin.com/v1/people/~/shares and the 401 error with [unauthorized]. authToken contains whitespace.
In my case, the error was incorrect appkey and appsecret values.
So to solve the issue, first of all make sure that the values are ok.
You can check them on the same error page. They are shown like this:
[application_key:protected] => <your application key here>
[application_secret:protected] => <your application secret here>
Click here to find your linkedin appkey and appsecret