Closed rajeshmeniya closed 10 years ago
tried following
$x = $linkedIn->api('v1/people/~/shares', array('format'=>'xml', 'oauth2_access_token'=>'randomUserTokenGeneratedAtLinkedin'), 'POST', $xml);
print_r($x);
But, it returns below error " 401 1404824467258 PLA5D8UVDG 0 Invalid access token. "
The user access token is not the same as the OAuth tokens. The OAuth is to authenticate you application. The user access token is to authenticate your application with a user...
Look at the example in the Readme. It tells you how to authenticate a user. When a user is authenticate you may run $linkedIn->getAccessToken()
to get a user access token. You may save that token in your application.
At some later point you fetch that token from your storage and...
$token= //from database
$linkedIn->setAccessToken($token);
$linkedIn->api('v1/people/~/shares', array('format'=>'xml'), 'POST', $xml);
Ok, but how can I share from backend script (cron).
Is it possible using OAuthTokens generated at linkedin application setting.
You do exactly the same if you want to authenticate from a backend script. Just authenticate yourself and save your access token. Then run the code I provided you..
You may not use the OAuthTokens as access tokens. That is how the LinkedIn API is designed.
I have oauth2 access token and want to use to share on linkedin, can you please tell me how to do this?
I have both OAuth User Token: "randomUserTokenGeneratedAtLinkedin" OAuth User Secret: "randomUserSecretGeneratedAtLinkedin"
which and how to use it??