Earlier I posted about the LinkedIn API error Profile data could not be retrieved . The current error 401 [unauthorized]. authToken contains whitespace is also due to the similar reason (in my case) when trying to share a link through post on linkedin from my application.
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