PHP Classes

LinkedIn - Oauth2

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How Can the PHP OAuth...  >  All threads  >  LinkedIn - Oauth2  >  (Un) Subscribe thread alerts  
Subject:LinkedIn - Oauth2
Summary:Updated library to use Oauth2 for LinkedIn
Messages:2
Author:Bart Steward
Date:2013-04-09 21:16:56
Update:2013-04-10 03:46:18
 

  1. LinkedIn - Oauth2   Reply   Report abuse  
Picture of Bart Steward Bart Steward - 2013-04-09 21:16:56
Hi,

I've been using your Oauth library for a few months now and am very please with it. I often find setting up Oauth 1 apps a challenge. After struggling with LinkedIn for some time, I modified the library to use Oauth2 for LinkedIn and all my problems went away. In addition to modifying Initialize(), I also had to create some wrapper functions in my sub-classes (I created sub-classed oauth_client.php for each of my social channels) that append the access_token to the end of the endpoint URLs for the user profile and connections (friends).

Curious, I also needed to put some 'exit' commands inside process() just after "$this->exit = true" lines for both v1 and v2. I've included your library into a CakePHP shell as Cake Libraries inside it's Lib directory. I assume that has something to do with it. Any thoughts?

Thanks for the great library!
Bart Steward

  2. Re: LinkedIn - Oauth2   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-04-10 03:46:18 - In reply to message 1 from Bart Steward
I do not see any reason why you did not manage to access LinkedIn API with OAuth 1. Maybe it is the way you are setting the parameters. You need to send me an example so I can see what is wrong.

Anyway, for OAuth 2 the CallAPI function already appends the access token parameter to the request URL.

The process function sets the exit variable precisely to tell the calling script to exit immediately, so the class does not have to abruptly exit your script.

All you need to do in your code that calls the class is to check the exit variable so you can gracefully exit your script. This is explained in the documentation.