Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I/O error on POST request for "https://api.fitbit.com/oauth2/token"

Randomly I get errors for https://api.fitbit.com/oauth2/token call. 
Here is my cURL:

curl --location --request POST 'https://api.fitbit.com/oauth2/token' \
--header 'Authorization: Basic <REDACTED>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: JSESSIONID=1970EDD2F5A921D4600ED56818D89ECB.fitbit1; fct=bc3e2f3cefd34286920ed521cdfb75c9' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'clientId=22CXWP' \
--data-urlencode 'redirect_uri=https://<REDACTED>' \
--data-urlencode 'code=985bff2c5f6608e4715205ac5fc1f4df26a297cd'


This cURL %90 works fine but sometimes I get an error at the first connection attempt. 

Thanks in advance

Best Answer
0 Votes
3 REPLIES 3

Hi @ismail-koembe 

 

We did have a slight problems with the /oauth2/token endpoint earlier this week that seems to be resolved.   Would you please let me know if you are still seeing the behavior?   If so, what error message are you getting?

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hey @Gordon-C 
I could reproduce the same issue last week and just 3 mins ago. The interesting thing is it happens at the first attempt.
[curl -X POST \\n-H 'Authorization: Basic <REDACTED>' -H 'Content-Type: application/x-www-form-urlencoded' \\n -d '"grant_type=authorization_code&clientId=22CXWP&redirect_uri=https://<REDACTED>/account/connect/fitbit&code=3c7475ac2da92e28383f3a9d22f1d3c85988369e"' \\n'https://api.fitbit.com/oauth2/token']" 

Next time same cURL with the new code worked fine (new code: 8d91230f3fa1f2a4a2917b5549be9ced241b1174) These codes are being produced on Fitbit and once we got it, we put them in our request. 
Since its reproducibility is very low, it is really hard to debug it.  

The error message : 
Caused by: java.net.SocketException: Connection reset\n\tat java.net.SocketInputStream.read(SocketInputStream.java:210)\n\tat java.net.SocketInputStream.read(SocketInputStream.java:141)\n\tat sun.security.ssl.InputRecord.readFully(InputRecord.java:465)\n\tat sun.security.ssl.InputRecord.read(InputRecord.java:503)\n\tat sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:990)\n\tat sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:948)\n\tat sun.security.ssl.AppInputStream.read(AppInputStream.java:105)\n\tat org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)\n\tat org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)\n\tat org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)\n\tat org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)\n\tat org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)\n\tat org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)\n\tat org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)\n\tat org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)\n\tat org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)\n\tat org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)\n\tat org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)\n\tat org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)\n\tat org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)\n\tat org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)\n\tat org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)\n\tat org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)\n\tat org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)\n\tat org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:87)\n\tat org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)\n\tat org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)\n\tat
I/O error on POST request for "https://api.fitbit.com/oauth2/token": Connection reset; nested exception is java.net.SocketException: Connection reset\n\tat org.springframework.web.client.RestTemplate.doExecute



Best Answer
0 Votes

Hi @ismail-koembe 

 

Are you still receiving the Connection Reset error on /oauth2/token endpoint?   

 

Thanks!

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes