Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Not able to refresh token

    Posted 06-05-2025 18:21

    mkoya | 2022-02-02 05:08:27 UTC | #1

    HI,

    I expected refresh token set a should RefreshAccessToken Flag.(below) ApiClient.set Should RefreshAccessToken(true);.

    However, "POST /oauth/token " result is "[read] I/O error: Connection reset". Why do I / O errors occur? Please tell me the correct token refresh procedure.


    anon11147534 | 2022-02-02 09:49:03 UTC | #2

    Hi,

    I haven't been able to reproduce this issue. Do you have a stack trace from this error?


    mkoya | 2022-02-02 11:51:28 UTC | #3

    I'm using authorizeClientCredentials() and found that it doesn't support token refresh. So I'm trying to periodically execute authorizeClientCredentials() before the token expires. Is this the correct procedure for token refresh?

    "[Read] I / O error: Connection reset" sometimes occurs in the response of "POST /oauth/token". What is the cause of the reset from the Genesys Cloud side?

    I haven't got the stack trace, so I'll send it when I get it.


    anon11147534 | 2022-02-02 13:02:20 UTC | #4

    Yes, the token refresh feature currently only works for the Authorization Code Grant. That seems like a reasonable way to avoid the token expiring. I'm not too sure what the cause is but if you can get me a stack trace I will look into it.


    mkoya | 2022-02-03 00:03:51 UTC | #5

    It's not "POST / oauth / token", but I'm getting the same error. Please check the stack trace. The SDK is platform-client-v2: 134.0.0.


    [2022/02/03 08:56:45.137] DEBUG : Thread-6 - http-outgoing-3 << "[read] I/O error: Connection reset" [2022/02/03 08:56:45.137] DEBUG : Thread-6 - http-outgoing-3: Close connection [2022/02/03 08:56:45.137] DEBUG : Thread-6 - http-outgoing-3: Shutdown connection [2022/02/03 08:56:45.137] DEBUG : Thread-6 - Connection discarded [2022/02/03 08:56:45.137] DEBUG : Thread-6 - Connection released: [id: 3][route: {s}->https://api.mypurecloud.jp:443][total available: 1; route allocated: 0 of 2; total allocated: 1 of 20] [2022/02/03 08:56:45.137] ERROR : Thread-6 - javax.net.ssl.SSLException: Connection reset at sun.security.ssl.Alert.createSSLException(Alert.java:127) at sun.security.ssl.TransportContext.fatal(TransportContext.java:324) at sun.security.ssl.TransportContext.fatal(TransportContext.java:267) at sun.security.ssl.TransportContext.fatal(TransportContext.java:262) at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1563) at sun.security.ssl.SSLSocketImpl.access$400(SSLSocketImpl.java:73) at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:973) at org.apache.http.impl.conn.LoggingInputStream.read(LoggingInputStream.java:84) at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137) at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153) at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) at com.mypurecloud.sdk.v2.connector.apache.ApacheHttpClientConnector.invoke(ApacheHttpClientConnector.java:71) at com.mypurecloud.sdk.v2.ApiClient.getAPIResponse(ApiClient.java:750) at com.mypurecloud.sdk.v2.ApiClient.invoke(ApiClient.java:868) at com.mypurecloud.sdk.v2.api.NotificationsApi.putNotificationsChannelSubscriptions(NotificationsApi.java:647) at com.mypurecloud.sdk.v2.api.NotificationsApi.putNotificationsChannelSubscriptions(NotificationsApi.java:613) at co.nextgen.gcmanager.service.GenesysCloudCommServiceImpl$RefreshSession.lambda$run$0(GenesysCloudCommServiceImpl.java:1271) at java.util.HashMap.forEach(HashMap.java:1289) at co.nextgen.gcmanager.service.GenesysCloudCommServiceImpl$RefreshSession.run(GenesysCloudCommServiceImpl.java:1255) at java.lang.Thread.run(Thread.java:748) Suppressed: java.net.SocketException: Broken pipe (Write failed) at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) at java.net.SocketOutputStream.write(SocketOutputStream.java:155) at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81) at sun.security.ssl.TransportContext.fatal(TransportContext.java:355) ... 32 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:210) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464) at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68) at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1341) at sun.security.ssl.SSLSocketImpl.access$300(SSLSocketImpl.java:73) at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:957) ... 27 more


    anon11147534 | 2022-02-03 17:18:36 UTC | #6

    Thanks for posting the stack trace. This is most likely related to an issue that we are already looking into. I've forwarded on the stack trace and I'll keep you updated on the progress.


    system | 2022-03-06 17:18:40 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 13409