Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linkedin OAuth2 401 Not Authorized problem #137

Closed
aristotelesweb opened this issue Nov 5, 2013 · 9 comments
Closed

Linkedin OAuth2 401 Not Authorized problem #137

aristotelesweb opened this issue Nov 5, 2013 · 9 comments

Comments

@aristotelesweb
Copy link

Hi,
I used the library for 1 month and it worked great! Thanks for making it. :)

Unfortunately, since november the 1st, it stopped working. To check whether it is a problem of my own code. I downloaded the library again, deployed it on the server and tested the linkedin example.

When I am logged in on linkedin the example is working fine. If i'm not logged in on linkedin, I see the "Accept page" of linkedin, I click on Accept and I am redirected to the example. Then I get the following error:

Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException' with message 'file_get_contents(https://api.linkedin.com/v1/people/~?format=json&oauth2_access_token=AQWYrEZcx1LMEQLgiVAsnfJV0EXOMnaw_0HX2mcB3YbmpOazNwscvclxSZQtZ-kWi_cd_iJ7Mh0zsqDwUOCAt2qL5OKHiTj2GG_q3PruEKwR7jMMV0dAlUgw-clwl2ik91WNmawJrch3pqwYe0HBDqbd31bmM_LixWbdunZwALRHZwGV0l0) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized ' in /var/www/vhosts/...../httpdocs/public/test/src/OAuth/Common/Http/Client/StreamClient.php:64 Stack trace: #0 /var/www/vhosts/...../httpdocs/public/test/src/OAuth/OAuth2/Service/AbstractService.php(153): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), NULL, Array, 'GET') #1 /var/www/vhosts/...../httpdocs/public/test/examples/linkedin.php(43): OAuth\OAuth2\Service\AbstractService->request('/people/~?forma...') #2 {main} thrown in /var/www/vhosts/..../httpdocs/public/test/src/OAuth/Common/Http/Client/StreamClient.php on line 64

Perhaps Linkedin has changed something? Do you have the same problem?

Thanks in advance,
Kind Regards,

Roland

@PeeHaa
Copy link
Collaborator

PeeHaa commented Nov 5, 2013

Can this be related: http://developer.linkedin.com/thread/2233?

@flavioheleno
Copy link
Contributor

Is that & on the URL expected..?

@aristotelesweb
Copy link
Author

Hi.
Thanks for your quick response, the help is much appreciated. :)

In streamclient.php, I put a die() after the file_get_contents function and I see that there is a warning:

Warning: file_get_contents(https://api.linkedin.com/v1/people/~?format=json&oauth2_access_token=AQXgKu5BUmWdSNZAivq-uMeh4AL1CZgpL3nX36h9vYJYruGUsTeRqpuc_cdK-hy3UscOXfKJUd7wZ2p36A4VcRYrhhIF6EIQiCZ6cCFPI6VUNrH1kmiaN6Q68cObrvoBrUeNVjk5uatB53dSAuCbyMJWaTBev1vRKY5n2TvBM30FbYHeTKQ) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in /var/www/vhosts/..../httpdocs/public/test/src/OAuth/Common/Http/Client/StreamClient.php on line 57

The url does not have & amp;, I guess that is from the output of the php exception handler....

As for the link:

Thanks again, :)
Kind Regards,

Roland

@aristotelesweb
Copy link
Author

Hi,
oke, I finally solved the problem. It seems the problem only occurs with the linkedin account I used for testing. I created a new account. With it the library is working fine again. As to why it didn't work anymore with the old account, I really do not know. It worked for one month! Possibly I used it to long for testing, or triggered some security measure... Hopefully someone else will benefit from my problems.... :S

Thanks for your kind response. :)

@daviddesberg
Copy link
Owner

Closed because you have fixed the issue :)

@cmodijk
Copy link
Contributor

cmodijk commented Nov 13, 2013

We also have the same problems authenticating with LinkedIn and we are getting the same error's. We are trying to migrate from the Zend framework oauth 1 libary to this one but we also have this issue with "Not Authorized problem". We tried 3 different LinkedIn accounts and 2 out of 3 have this problem. And the old Zend version is still working with the same users.

While testing I implemented a version of LinkedIn oauth1 class based on the Twitter version like this one and that works like a charm https://gist.github.com/cmodijk/7445418. But if I register this in the ServiceFactory it won't get an instance because it checks the Oauth2 class first...

@aristotelesweb
Copy link
Author

@cmodijk:
It seems that LinkedIn blocks accounts temporarily. The test account that was blocked (see above), is now working fine again. And the account that I created last week, is now blocked... I think LinkedIn blocks it when you authenticate it to often....

@cmodijk
Copy link
Contributor

cmodijk commented Nov 15, 2013

@aristotelesweb:
Tnx for your response that could be the case it is hard to test this. But what I find strange the oauth 1 version works fine with al the same accounts.

@msd-kharazi
Copy link

stupid clevers make life hard for us too. Cant find any solution anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants