开发者

LinkedIn with Pecl OAuth: "got a 400, expected HTTP/1.1 20X or a redirect"

I have Pecl OAuth with PHP5 on a Debian box and I try to authenticate to LinkedIn. When calling;

OAuth->getAccessToken('https://api.lin...')\n#1

I get;

PHP Fatal error: Uncaught exception 'OAuthException' with message 'Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect)'

I have tried it from scratch and I have tried the PHP API wrappers th开发者_如何学Pythonat are available and (ofcourse, because they use OAuth Pecl ext) have all the same problem.

I read somewhere it might be the timestamp on the server, but I synched that up with ntpdate; it does that quite often now, so the offset with the timeservers is almost 0.

I tried this class first; http://www.linkedphp.com/2009/11/26/first-release-classes-to-connect-with-php-to-linkedin-api/, someone in the comments has the same problem, however the creator of the class says 'do you get a login screen'; I don't, I get a 'Grant or Deny' screen once, after that a blank screen and the above error in my logs.

What else can it be?

Thanks


Yep, confirmed. Timestamp IS the problem. Make sure your server date/time is in sync with the rest of the world (i use Timeserver hostnames or addresses: ntp.cpsc.ucalgary.ca ) nb: I'm starting to think that this whole oauth thing is a bad , complicated thing :)


You should post your code.

Besides the timestamp issues, missing callbacl URL in the request can also cause this error.


Try using the format:

$access_token_info = $oauth->getAccessToken($accesstokenurl, "", $token);

where $token is the 5 digit confirmation code

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜