yangboz / linkedin-j

Automatically exported from code.google.com/p/linkedin-j
0 stars 0 forks source link

oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed #43

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. while retriving OAuth request token 

What is the expected output? 
Expected output should get the token key and token key secert

What do you see instead?
oauth.signpost.exception.OAuthCommunicationException: Communication with the 
service provider failed: Server returned HTTP response code: 400 for URL: 
https://api.linkedin.com/uas/oauth/requestToken?oauth_callback=oob
    at oauth.signpost.basic.DefaultOAuthProvider.retrieveToken(DefaultOAuthProvider.java:150)
    at oauth.signpost.basic.DefaultOAuthProvider.retrieveRequestToken(DefaultOAuthProvider.java:66)
    at linkedIn.OAuthSample.main(OAuthSample.java:27)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for 
URL: https://api.linkedin.com/uas/oauth/requestToken?oauth_callback=oob
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at oauth.signpost.basic.DefaultOAuthProvider.retrieveToken(DefaultOAuthProvider.java:129)
    ... 2 more
Caused by: java.io.IOException: Server returned HTTP response code: 400 for 
URL: https://api.linkedin.com/uas/oauth/requestToken?oauth_callback=oob
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at oauth.signpost.basic.DefaultOAuthProvider.retrieveToken(DefaultOAuthProvider.java:123)
    ... 2 more

What version of the product are you using? On what operating system?
linkedin-j-1[1].0.335-rc2
signpost-core-1.1-SNAPSHOT
commons-codec-1.3
OS : Win2000 sp4

Original issue reported on code.google.com by jude.sah...@gmail.com on 7 Sep 2010 at 7:32

GoogleCodeExporter commented 9 years ago
I am running my application on local machine, it runs fine, but as I move it to 
server hosted on unix. I get error:
oauth.signpost.exception.OAuthCommunicationException: Communication with the 
service provider failed: Server returned HTTP response code: 400 for URL: 
https://api.linkedin.com/uas/oauth/requestToken
        at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)

I have checked the time, there time difference is less than 1 minute.

Original comment by gaurava....@gmail.com on 8 Sep 2010 at 7:25

GoogleCodeExporter commented 9 years ago
Can you try using the signpost jar included in the distribution (lib directory)?

Original comment by nabeelmukhtar on 27 Jan 2011 at 7:33

GoogleCodeExporter commented 9 years ago
send reply to nidhincee@gmail.com

Original comment by nidhin...@gmail.com on 27 Apr 2011 at 10:05

GoogleCodeExporter commented 9 years ago
I have run into this problem before, however I believe it is a matter of the 
LinkedIn server not responding in the appropriate time. 

A valid solution may be to implement a retry when obtaining OAuth 
authentication as usually the very next call will be a success. (This is 
similar to the strategy employed by Twitter4j)

Original comment by dave.z...@yupiq.com on 17 Aug 2011 at 7:04

GoogleCodeExporter commented 9 years ago
I'm plagued by this very same infamous error.
java.io.IOException: Server returned HTTP response code: 400 for URL: 
https://api.linkedin.com/uas/oauth/requestToken
My application was working fine from both my server and local windows 7 box. It 
stopped working today. There were intermittent issues for the last 2 days.
The only change I did was use the latest version of linkedin-j-1.0.429 jar. I 
have this change as well.
I syned up the time in my local to 'time.windows.com'. It does not help either.
I have issued two requests in a series. The second one from within the catch 
block of the first.

PL. help.
Regards,
KUmar

Original comment by Rajan...@gmail.com on 30 Jun 2012 at 4:40

GoogleCodeExporter commented 9 years ago
I'm trying to use LinkedIn authentication for the first time. I have a java 
program that uses an HttpURLConnection to connect to 
https://api.linkedin.com/uas/oauth/requestToken and I get a response code of 
400 every time. I tried leaving out the authentication header so that the HTTP 
request was as uncomplicated as possible but this made no difference. It looks 
as though the server is getting something fundamentally wrong when parsing the 
request - a plain POST request with no authentication header should surely be 
parsed correctly and result in response code 401, not 400.

Original comment by cloud-te...@opengroup.org on 12 Dec 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Linked Api is updated and need security params while requesting token you need 
to add params "scope=rw_nus+r_basicprofile" and this should be done by 
linkedin-j, but the fix not available due to that i made patched linkedin-j lib 
and you can get from below link

http://db.tt/yQjhqeq3

and refer my post 

http://stackoverflow.com/questions/12188341/cant-post-anything-on-linkedin-using
-linkedin-j/13510881#13510881

Original comment by ashok200...@gmail.com on 13 Dec 2012 at 5:12

GoogleCodeExporter commented 9 years ago
Thanks ashok - but this didn't crack it for me. It looks as though 400 is 
returned in a number of different cases where the basic HTTP syntax is OK but 
the request is not in a format that the server accepts. I found in my case that 
it was because I was using PLAINTEXT. (Where does LinkedIn's documentation say 
you can't?)

Original comment by cloud-te...@opengroup.org on 13 Dec 2012 at 10:29