twilio / twilio-chat-demo-ios

Twilio Programmable Chat Demo Application for iOS
28 stars 16 forks source link

Error validating token #35

Closed brightsider closed 5 years ago

brightsider commented 6 years ago

App supported offline mode.

  1. App started with offline connection
  2. Connection changed to online
  3. Get token from backend
  4. Set token to TwilioChatClient
  5. TwilioChatClient starts generating "Error validating token."
  6. App repeating 3-4 steps for connect.

Log: 2018-01-10 10:20:15.695 [1014:799201] <<<<TwilioChatClient: 0x1b040f30>>>> TNWebsocket[2]: 0x1fe49000 | 01/10/10:20:15.695 | WARNING | 16 | TNWebsocket | Poco net exception while connecting: SSL connection unexpectedly closed 2018-01-10 10:20:15.708 [1014:799135] <<<<TwilioChatClient: 0x1b040f30>>>> TCHttpObserver[2]: 0x1fc41000 | 01/10/10:20:15.707 | WARNING | 20 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:20.720 [1014:799121] <<<<TwilioChatClient: 0x1b040f30>>>> TCHttpObserver[2]: 0x1f4a3000 | 01/10/10:20:20.719 | WARNING | 21 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:22.708 [1014:799201] <<<<TwilioChatClient: 0x1b040f30>>>> TNWebsocket[2]: 0x1fe49000 | 01/10/10:20:22.708 | WARNING | 16 | TNWebsocket | Poco exception while connecting: I/O error: Bad socket descriptor 2018-01-10 10:20:25.735 [1014:799127] <<<<TwilioChatClient: 0x1b040f30>>>> TCHttpObserver[2]: 0x1f831000 | 01/10/10:20:25.734 | WARNING | 22 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:25.738 [1014:798984] <<<<TwilioChatClient: 0x1b040f30>>>> Chat-iOS[0]: 0x4040f000 | 01/10/10:20:25.738 | FATAL | Chat-iOS | Error validating token: 3 10:20:25:741 [Error] [ChatManager.swift:356] chatClient(_:errorReceived:) > Error validating token.

2018-01-10 10:20:32.867 [1014:799233] <<<<TwilioChatClient: 0x1b639340>>>> TNWebsocket[2]: 0x1f29b000 | 01/10/10:20:32.867 | WARNING | 25 | TNWebsocket | Poco net exception while connecting: SSL connection unexpectedly closed 2018-01-10 10:20:32.882 [1014:799134] <<<<TwilioChatClient: 0x1b639340>>>> TCHttpObserver[2]: 0x1fbbf000 | 01/10/10:20:32.881 | WARNING | 29 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:37.895 [1014:799135] <<<<TwilioChatClient: 0x1b639340>>>> TCHttpObserver[2]: 0x1fc41000 | 01/10/10:20:37.894 | WARNING | 30 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:39.874 [1014:799233] <<<<TwilioChatClient: 0x1b639340>>>> TNWebsocket[2]: 0x1f29b000 | 01/10/10:20:39.873 | WARNING | 25 | TNWebsocket | Poco exception while connecting: I/O error: Bad socket descriptor 2018-01-10 10:20:42.913 [1014:799125] <<<<TwilioChatClient: 0x1b639340>>>> TCHttpObserver[2]: 0x1f72d000 | 01/10/10:20:42.913 | WARNING | 31 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:42.916 [1014:798984] <<<<TwilioChatClient: 0x1b639340>>>> Chat-iOS[0]: 0x4040f000 | 01/10/10:20:42.916 | FATAL | Chat-iOS | Error validating token: 3 10:20:42:918 [Error] [ChatManager.swift:356] chatClient(_:errorReceived:) > Error validating token.

2018-01-10 10:20:50.053 [1014:799274] <<<<TwilioChatClient: 0x1b6432e0>>>> TNWebsocket[2]: 0x1fe49000 | 01/10/10:20:50.053 | WARNING | 34 | TNWebsocket | Poco exception while connecting: I/O error: Bad socket descriptor 2018-01-10 10:20:50.056 [1014:799133] <<<<TwilioChatClient: 0x1b6432e0>>>> TCHttpObserver[2]: 0x1fb3d000 | 01/10/10:20:50.056 | WARNING | 38 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:55.066 [1014:799134] <<<<TwilioChatClient: 0x1b6432e0>>>> TCHttpObserver[2]: 0x1fbbf000 | 01/10/10:20:55.065 | WARNING | 39 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:20:57.067 [1014:799274] <<<<TwilioChatClient: 0x1b6432e0>>>> TNWebsocket[2]: 0x1fe49000 | 01/10/10:20:57.066 | WARNING | 34 | TNWebsocket | Poco exception while connecting: I/O error: Bad socket descriptor 2018-01-10 10:21:00.082 [1014:799121] <<<<TwilioChatClient: 0x1b6432e0>>>> TCHttpObserver[2]: 0x1f4a3000 | 01/10/10:21:00.081 | WARNING | 40 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:21:00.085 [1014:798984] <<<<TwilioChatClient: 0x1b6432e0>>>> Chat-iOS[0]: 0x4040f000 | 01/10/10:21:00.085 | FATAL | Chat-iOS | Error validating token: 3 10:21:00:088 [Error] [ChatManager.swift:356] chatClient(_:errorReceived:) > Error validating token.

2018-01-10 10:21:07.171 [1014:799308] <<<<TwilioChatClient: 0x1b51f310>>>> TNWebsocket[2]: 0x1fe49000 | 01/10/10:21:07.170 | WARNING | 43 | TNWebsocket | Poco exception while connecting: I/O error: Bad socket descriptor 2018-01-10 10:21:07.194 [1014:799132] <<<<TwilioChatClient: 0x1b51f310>>>> TCHttpObserver[2]: 0x1fabb000 | 01/10/10:21:07.194 | WARNING | 47 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:21:12.209 [1014:799133] <<<<TwilioChatClient: 0x1b51f310>>>> TCHttpObserver[2]: 0x1fb3d000 | 01/10/10:21:12.209 | WARNING | 48 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-01-10 10:21:15.854 [1014:799307] <<<<TwilioChatClient: 0x1b51f310>>>> TNTwilsockClientImpl[1]: 0x1fdc7000 | 01/10/10:21:15.854 | CRITICAL | 42 | TNTwilsockClientImpl | Message type list is empty 10:21:15:855 [Debug] [ChatManager.swift:268] chatClient(:connectionStateUpdated:) > 1 2018-01-10 10:21:15.855 [1014:799307] <<<<TwilioChatClient: 0x1b51f310>>>> TNRegNotificationCtxSession[2]: 0x1fdc7000 | 01/10/10:21:15.855 | WARNING | 57 | TNRegNotificationCtxSession | Could not operate with notification context in twilsock. Error 16 2018-01-10 10:21:15.855 [1014:799307] <<<<TwilioChatClient: 0x1b51f310>>>> TNNotificationClient[0]: 0x1fdc7000 | 01/10/10:21:15.855 | FATAL | 52 | TNNotificationClient | Fatal error while registering twilsock connection: 9: Message type list is empty, public error code: 0 2018-01-10 10:21:15.857 [1014:799324] <<<<TwilioChatClient: 0x1b51f310>>>> TNNotificationClient[2]: 0x1f219000 | 01/10/10:21:15.856 | WARNING | 52 | TNNotificationClient | onTwilsockError: 0 - Message type list is empty 10:21:15:919 [Debug] [ChatManager.swift:268] chatClient(:connectionStateUpdated:) > 3 10:21:16:345 [Debug] [ChatManager.swift:273] chatClient(:synchronizationStatusUpdated:) > 0 10:21:17:181 [Debug] [ChatManager.swift:268] chatClient(:connectionStateUpdated:) > 2 10:21:21:666 [Debug] [ChatManager.swift:273] chatClient(:synchronizationStatusUpdated:) > 1 10:21:28:914 [Debug] [ChatManager.swift:273] chatClient(:synchronizationStatusUpdated:) > 2

glitch182 commented 6 years ago

Facing the same issue

rbeiter commented 6 years ago

Hi @brightsider,

From the log above it looks like once the connection resumed, chat did initialize fully. The error validating token messages you see were when the network was unreachable still, when at the end of the log you see connectionStateUpdated was called with TCHClientConnectionStateConnected (2) the client was connected again and when synchronizationStatusUpdated was called with TCHClientSynchronizationStatusCompleted (2) the client was fully synchronized. Was the client not usable after the connection was re-established?

Thank you, Randy

rbeiter commented 6 years ago

Hi @vishaluae,

Are you seeing the validating token messages while the network is disconnected? If so, this is expected behavior. Once the network returns though, you should see the client re-establish if it was already connected. If this was during the client creation though, you may need to re-try creating the client once the connection is operational, perhaps using Apple's Reachability framework as an indicator the network is present. You can also retry based on a failed return value of creating the Chat client.

Thank you, Randy

brightsider commented 6 years ago

@rbeiter I'm showing errors for user in alert. Should I to retry automatically to connect after this error and doesn't show alert for user? And why needs so many retries with good connection for stop getting error?

glitch182 commented 6 years ago

Hey @rbeiter,

Turned out to be some server side issue. Apologies.

brightsider commented 6 years ago

@vishaluae can you help me with this error? How to fix it?

chetanzala commented 6 years ago

After integrating twilio is working but suddenly it's not working. I try to surtout but i am facing this

2018-05-14 10:32:06.447019+0530 IVIOU[1055:41769] <<<<TwilioChatClient: 0x7ff5204083c0>>>> Chat-iOS[0]: 0x700005151000 | 05/14/10:32:06.446 | FATAL | Chat-iOS | Error validating token: 3 json_Come = ["token": eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTSzUyYzMxYzkxMmIyMjc5N2NkNzBjMGUxNTc2YzdlMGMwLTE1MjYyNzQxMjYiLCJncmFudHMiOnsiaWRlbnRpdHkiOiI5IiwiaXBfbWVzc2FnaW5nIjp7InNlcnZpY2Vfc2lkIjoiSVNlM2Q0ODFhNzkzZTU0NDY1YjRlM2M1YzIwMGU2MjIwOSIsImVuZHBvaW50X2lkIjoiaXZpb3UtY2hhdDo5OjEiLCJwdXNoX2NyZWRlbnRpYWxfc2lkIjoiQ1JkMWJkMGZiYjgzOTQzOWZkNDQyMTEzMzM2M2RmNjFhOCJ9fSwiaWF0IjoxNTI2Mjc0MTI2LCJleHAiOjE1MjYyNzc3MjYsImlzcyI6IlNLNTJjMzFjOTEyYjIyNzk3Y2Q3MGMwZTE1NzZjN2UwYzAiLCJzdWIiOiJBQzkwYjgyYTQ0ZjlmZTJjYzlhMTUwNmQwNGEyNTUzY2YzIn0.buZsFGOjsmbrT8SMDQnvgu4Mx8vo3Zu8N5sRIcEYILw, "_errors": <__NSArray0 0x604000013820>(

) ] 2018-05-14 10:32:08.377469+0530 IVIOU[1055:42593] <<<<TwilioChatClient: 0x7ff52042e420>>>> TNTwilsockClient[2]: 0x7000050ce000 | 05/14/10:32:08.377 | WARNING | 24 | TNTwilsockClient | Reply status for init request is not success: 401, AUTHENTICATION_FAILED 2018-05-14 10:32:08.646696+0530 IVIOU[1055:42593] <<<<TwilioChatClient: 0x7ff52042e420>>>> TNTransportDisconnectingState[2]: 0x7000050ce000 | 05/14/10:32:08.646 | WARNING | 11 | TNTransportDisconnectingState | Success reply can not be sent. Twilsock is not in connected state 2018-05-14 10:32:08.647050+0530 IVIOU[1055:42593] <<<<TwilioChatClient: 0x7ff52042e420>>>> TNTransportDisconnectingState[2]: 0x7000050ce000 | 05/14/10:32:08.646 | WARNING | 11 | TNTransportDisconnectingState | Disconnect procedure has been already started 2018-05-14 10:32:11.907898+0530 IVIOU[1055:42015] <<<<TwilioChatClient: 0x7ff52042e420>>>> TCHttpObserver[2]: 0x700005c93000 | 05/14/10:32:11.907 | WARNING | 30 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-05-14 10:32:16.910550+0530 IVIOU[1055:42003] <<<<TwilioChatClient: 0x7ff52042e420>>>> TCHttpObserver[2]: 0x70000566f000 | 05/14/10:32:16.910 | WARNING | 31 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-05-14 10:32:21.916600+0530 IVIOU[1055:42004] <<<<TwilioChatClient: 0x7ff52042e420>>>> TCHttpObserver[2]: 0x7000056f2000 | 05/14/10:32:21.916 | WARNING | 32 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-05-14 10:32:21.917061+0530 IVIOU[1055:41769] <<<<TwilioChatClient: 0x7ff52042e420>>>> Chat-iOS[0]: 0x700005151000 | 05/14/10:32:21.916 | FATAL | Chat-iOS | Error validating token: 3

Can any one help me to sort out this.

rbeiter commented 6 years ago

@chetanzala - 401 errors are typically permission related, indicating the instance sid and account sid do not match or the token was not signed with an appropriate key. Please reach out to Twilio support (https://www.twilio.com/help/contact) if you are still experiencing this issue so we can assist you further in a secure manner. Please reference this thread for extra background on the error you received. Thank you, Randy

otymartin commented 6 years ago

@rbeiter Hey, I just started getting this error now.

Afew facts, Im running my app's server via ngrok on my local machine. While I was at home on my own network, everything works well. I just teleported to my uncles house with the same ngrok instance running and initialization simply fails despite the rest of the app working and even fetching a new access token.

20:28:56.646 ❤️ ERROR MessagingManager.initializeClient():101 - Error Domain=signal.sdk.domain.error Code=102 "Error validating token." UserInfo={kTCHErrorMsgKey=Error validating token., NSLocalizedDescription=Error validating token.}
       0x16ef9b000 | 05/14/20:28:56.702 | DEBUG    | 6      | TNHttpTransportClient | ~TNHttpTransportClient - begin
       0x16ef9b000 | 05/14/20:28:56.702 | DEBUG    | 6      | TNHttpTransportClient | ~TNHttpTransportClient - end
20:28:56.734 💙 INFO MessagingManager.fetchAccessToken():163 - New Token👑
20:29:11.837 ❤️ ERROR MessagingManager.initializeClient():101 - Error Domain=signal.sdk.domain.error Code=102 "Error validating token." UserInfo={kTCHErrorMsgKey=Error validating token., NSLocalizedDescription=Error validating token.}
       0x16f13f000 | 05/14/20:29:11.873 | DEBUG    | 18     | TNHttpTransportClient | ~TNHttpTransportClient - begin
       0x16f13f000 | 05/14/20:29:11.874 | DEBUG    | 18     | TNHttpTransportClient | ~TNHttpTransportClient - end

Here are full logs.

Coincidentally, while capturing full logs for you, initialization completed (took forever) however would still like to get a complete understanding of what was going wrong.

Anushka3174 commented 5 years ago

I am getting the same issue. Did you guys fix it? Can anyone help?

berkus commented 5 years ago

Please contact twilio support and provide your account and token details to them. Use this link https://www.twilio.com/help/contact

Anushka3174 commented 5 years ago

Hi, Thanks, I did but they haven't written us back and the issue is critical. Is there a way I can get in touch with them? Any other way for a faster response?

On Wed, Dec 12, 2018 at 1:09 PM Berkus Decker notifications@github.com wrote:

Please contact twilio support and provide your account and token details to them. Use this link https://www.twilio.com/help/contact

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/twilio/twilio-chat-demo-ios/issues/35#issuecomment-446488277, or mute the thread https://github.com/notifications/unsubscribe-auth/AdxXczM94SXfpzVc1LwSvZdGVk3FUCtLks5u4K9CgaJpZM4RY9vv .

berkus commented 5 years ago

Could you post the full collected logs here? As Randy wrote above the usual case is signing the token with incorrect key, if the token itself is ok; but lets see the logs first.

Anushka3174 commented 5 years ago

I have attached the log with this mail.

On Wed, Dec 12, 2018 at 1:32 PM Berkus Decker notifications@github.com wrote:

Could you post the full collected logs here? As Randy wrote above the usual case is signing the token with incorrect key, if the token itself is ok; but lets see the logs first.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/twilio/twilio-chat-demo-ios/issues/35#issuecomment-446493377, or mute the thread https://github.com/notifications/unsubscribe-auth/AdxXc-XUfzzkYCnvf-F_xEjbYBSsA-6cks5u4LSggaJpZM4RY9vv .

All Debug Logs from Twillio in App:- 2018-12-12 14:08:03.742351+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> [4]: 0x70000960f000 | 12/12/14:08:03.740 | DEBUG | | Using root certificate store: /Users/admin/Library/Developer/CoreSimulator/Devices/7879FCEB-2247-48A4-B252-C13FCE3F304F/data/Containers/Bundle/Application/6A18269D-63A4-4F6E-9927-048A284BD481/Caviar.app/Frameworks/TwilioChatClient.framework/rootcert.pem 2018-12-12 14:08:03.831308+0545 Caviar[38883:262217] <<<<TwilioChatClient: 0x7f975be3c930>>>> Chat-iOS[4]: 0x108f835c0 | 12/12/14:08:03.831 | DEBUG | Chat-iOS | network is no longer reachable 2018-12-12 14:08:03.885431+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> IoService[3]: 0x70000960f000 | 12/12/14:08:03.885 | INFO | IoService | Creating 16 threads in the executor pool 2018-12-12 14:08:03.886594+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x70000960f000 | 12/12/14:08:03.886 | DEBUG | 1 | TNTwilsockClient | client: version: 2.5.1, build id: 243, build branch: refs/heads/master, os: ios, arch: x86_64 2018-12-12 14:08:03.887302+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x70000960f000 | 12/12/14:08:03.887 | DEBUG | 1 | TNTwilsockClient | Default thread pool: Available: 16; Capacity: 16 2018-12-12 14:08:03.887930+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:03.887 | INFO | 1 | TNTwilsockClient | connectImpl >> Disconnected 2018-12-12 14:08:03.888340+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:03.888 | DEBUG | 3 | TNTwilsockClientImpl | connect 2018-12-12 14:08:03.888881+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x70000960f000 | 12/12/14:08:03.887 | INFO | 4 | TNHttpTransportClient | initialising... 2018-12-12 14:08:03.888987+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNDisconnectedState[3]: 0x700009174000 | 12/12/14:08:03.888 | INFO | 2 | TNDisconnectedState | Leaving state: Disconnected 2018-12-12 14:08:03.889062+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:03.888 | DEBUG | 5 | TNWebsocket | Connecting... 2018-12-12 14:08:03.889600+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:03.889 | INFO | 1 | TNTwilsockClient | Change state: Disconnected --> Transport connecting 2018-12-12 14:08:03.889624+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:03.889 | DEBUG | 5 | TNWebsocket | Trying to establish connection to: https://tsock.us1.twilio.com 2018-12-12 14:08:03.890253+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportConnectingState[3]: 0x700009174000 | 12/12/14:08:03.889 | INFO | 6 | TNTransportConnectingState | Entering state: Transport connecting 2018-12-12 14:08:03.891024+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:03.890 | DEBUG | 3 | TNTwilsockClientImpl | startTransportConnectingTimer 2018-12-12 14:08:03.891891+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:03.891 | INFO | 1 | TNTwilsockClient | addObserverImpl >> Transport connecting 2018-12-12 14:08:03.892255+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:03.892 | DEBUG | 3 | TNTwilsockClientImpl | addObserver 2018-12-12 14:08:03.892732+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x700009174000 | 12/12/14:08:03.892 | INFO | 4 | TNHttpTransportClient | twilsock is in disconnected state: Unknown reason 2018-12-12 14:08:03.892882+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x70000960f000 | 12/12/14:08:03.891 | INFO | 4 | TNHttpTransportClient | initialised 2018-12-12 14:08:03.893561+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x70000960f000 | 12/12/14:08:03.893 | DEBUG | 8 | TCEmsClient | TCEmsClient 2018-12-12 14:08:03.894070+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x70000960f000 | 12/12/14:08:03.893 | DEBUG | 7 | TCBackoffEmsClient | init 2018-12-12 14:08:03.894779+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x70000960f000 | 12/12/14:08:03.894 | DEBUG | 8 | TCEmsClient | init 2018-12-12 14:08:03.895399+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x70000960f000 | 12/12/14:08:03.895 | DEBUG | 7 | TCBackoffEmsClient | setToken, eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2E5YmMzNTViZjFlOTgyMTllOTljYzQ4Yzg1OTc1MzQ0LTE1NDQ2MDI5NzgiLCJncmFudHMiOnsiaWRlbnRpdHkiOiJwcmFrYXNoQGdtYWlsLmNvbSIsImlwX21lc3NhZ2luZyI6eyJzZXJ2aWNlX3NpZCI6IklTOTZhMmExMDJhZWI4NDg5YWIwZTE0MDA1ZjE1OGVhMWUiLCJlbmRwb2ludF9pZCI6IkNhdmlhcjpwcmFrYXNoQGdtYWlsLmNvbTpBNkRBMzc5MS1GRkJGLTQ1QTctQjE5OC0zREQzRTFBNzVCMTAiLCJwdXNoX2NyZWRlbnRpYWxfc2lkIjoiLSJ9fSwiaWF0IjoxNTQ0NjAyOTc4LCJleHAiOjE1NDQ2MDY1NzgsImlzcyI6IlNLYTliYzM1NWJmMWU5ODIxOWU5OWNjNDhjODU5NzUzNDQiLCJzdWIiOiJBQzYyZGE4MjQ2NGU3ODdkNDViYzA4M2ZiYjdlYzQwYWU0In0.ZPeVPFsPiyMA3igfekmBbhejm-MPXMqFmI_vy9KYEus 2018-12-12 14:08:03.895950+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x70000960f000 | 12/12/14:08:03.895 | DEBUG | 7 | TCBackoffEmsClient | scheduleSetToken 2018-12-12 14:08:03.896451+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[3]: 0x70000960f000 | 12/12/14:08:03.896 | INFO | 7 | TCBackoffEmsClient | schedule new task 2018-12-12 14:08:03.897044+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009486000 | 12/12/14:08:03.896 | DEBUG | 7 | TCBackoffEmsClient | internal set token run... 2018-12-12 14:08:03.897418+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009486000 | 12/12/14:08:03.897 | DEBUG | 8 | TCEmsClient | setToken 2018-12-12 14:08:03.897841+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009486000 | 12/12/14:08:03.897 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:03.899553+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009486000 | 12/12/14:08:03.899 | DEBUG | 9 | TCHttpObserver | client: version: 2.5.1, build id: 243, build branch: refs/heads/master, os: ios, arch: x86_64 2018-12-12 14:08:03.900721+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x700009486000 | 12/12/14:08:03.900 | INFO | 4 | TNHttpTransportClient | requestId=RQ0d8131ae473a4cbe9613d64de0ed5543, enqueueing request to: https://ems.us1.twilio.com/v1/token 2018-12-12 14:08:03.901164+0545 Caviar[38883:265046] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009486000 | 12/12/14:08:03.900 | DEBUG | 8 | TCEmsClient | setToken - end 2018-12-12 14:08:05.635639+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:05.635 | INFO | 1 | TNTwilsockClient | onTransportConnectedImpl >> Transport connecting 2018-12-12 14:08:05.636084+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:05.635 | DEBUG | 3 | TNTwilsockClientImpl | sendInit 2018-12-12 14:08:05.637183+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[3]: 0x700009174000 | 12/12/14:08:05.637 | INFO | 3 | TNTwilsockClientImpl | sendInit, id = 58b383b3ca9441d2a7d0dc1a37d74ed84ed8 2018-12-12 14:08:05.637632+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportConnectingState[3]: 0x700009174000 | 12/12/14:08:05.637 | INFO | 6 | TNTransportConnectingState | Leaving state: Transport connecting 2018-12-12 14:08:05.637668+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:05.637 | DEBUG | 5 | TNWebsocket | Sending frame via websocket (724) TWILSOCK V3.0 703 {"id":"58b383b3ca9441d2a7d0dc1a37d74ed84ed8","method":"init","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2E5YmMzNTViZjFlOTgyMTllOTljYzQ4Yzg1OTc1MzQ0LTE1NDQ2MDI5NzgiLCJncmFudHMiOnsiaWRlbnRpdHkiOiJwcmFrYXNoQGdtYWlsLmNvbSIsImlwX21lc3NhZ2luZyI6eyJzZXJ2aWNlX3NpZCI6IklTOTZhMmExMDJhZWI4NDg5YWIwZTE0MDA1ZjE1OGVhMWUiLCJlbmRwb2ludF9pZCI6IkNhdmlhcjpwcmFrYXNoQGdtYWlsLmNvbTpBNkRBMzc5MS1GRkJGLTQ1QTctQjE5OC0zREQzRTFBNzVCMTAiLCJwdXNoX2NyZWRlbnRpYWxfc2lkIjoiLSJ9fSwiaWF0IjoxNTQ0NjAyOTc4LCJleHAiOjE1NDQ2MDY1NzgsImlzcyI6IlNLYTliYzM1NWJmMWU5ODIxOWU5OWNjNDhjODU5NzUzNDQiLCJzdWIiOiJBQzYyZGE4MjQ2NGU3ODdkNDViYzA4M2ZiYjdlYzQwYWU0In0.ZPeVPFsPiyMA3igfekmBbhejm-MPXMqFmI_vy9KYEus"} 2018-12-12 14:08:05.638413+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:05.637 | DEBUG | 3 | TNTwilsockClientImpl | stopTransportConnectingTimer 2018-12-12 14:08:05.639320+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:05.638 | INFO | 1 | TNTwilsockClient | Change state: Transport connecting --> Initialising 2018-12-12 14:08:05.639750+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNInitialisingState[3]: 0x700009174000 | 12/12/14:08:05.639 | INFO | 10 | TNInitialisingState | Entering state: Initialising 2018-12-12 14:08:06.000849+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009fc8000 | 12/12/14:08:06.000 | DEBUG | 5 | TNWebsocket | Receive message 194 bytes 2018-12-12 14:08:06.001384+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x700009fc8000 | 12/12/14:08:06.001 | DEBUG | 1 | TNTwilsockClient | onMessageReceived (225) TWILSOCK V3.0 204 {"method":"reply","id":"58b383b3ca9441d2a7d0dc1a37d74ed84ed8","payload_size":0,"status":{"description":"Invalid Access Token issuer/subject","errorCode":20103,"code":401,"status":"AUTHENTICATION_FAILED"}} 2018-12-12 14:08:06.001879+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009fc8000 | 12/12/14:08:06.001 | INFO | 1 | TNTwilsockClient | onMessageReceived, method = 8, id = 58b383b3ca9441d2a7d0dc1a37d74ed84ed8 2018-12-12 14:08:06.002171+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009fc8000 | 12/12/14:08:06.001 | DEBUG | 3 | TNTwilsockClientImpl | proceedReplyMessage 58b383b3ca9441d2a7d0dc1a37d74ed84ed8 2018-12-12 14:08:06.002710+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x700009174000 | 12/12/14:08:06.002 | DEBUG | 1 | TNTwilsockClient | Reply for '58b383b3ca9441d2a7d0dc1a37d74ed84ed8' 2018-12-12 14:08:06.003186+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[2]: 0x700009174000 | 12/12/14:08:06.002 | WARNING | 1 | TNTwilsockClient | Reply status for init request is not success: 401, AUTHENTICATION_FAILED 2018-12-12 14:08:06.003582+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.003 | INFO | 1 | TNTwilsockClient | ReceivedErrorInitReply >> Initialising 2018-12-12 14:08:06.003950+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:06.003 | DEBUG | 3 | TNTwilsockClientImpl | notifyAboutError 2018-12-12 14:08:06.004389+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:06.004 | DEBUG | 3 | TNTwilsockClientImpl | disconnect 2018-12-12 14:08:06.004835+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009174000 | 12/12/14:08:06.004 | DEBUG | 5 | TNWebsocket | Disconnect 2018-12-12 14:08:06.005246+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009174000 | 12/12/14:08:06.004 | DEBUG | 5 | TNWebsocket | Reset session 2018-12-12 14:08:06.005687+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:06.005 | DEBUG | 5 | TNWebsocket | Disconnecting... 2018-12-12 14:08:06.351360+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009fc8000 | 12/12/14:08:06.351 | DEBUG | 5 | TNWebsocket | Receive message 194 bytes 2018-12-12 14:08:06.351849+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x700009fc8000 | 12/12/14:08:06.351 | DEBUG | 1 | TNTwilsockClient | onMessageReceived (223) TWILSOCK V3.0 202 {"method":"close","id":"TM029fdc4862ef459e9a769701bfb33e57","payload_size":0,"status":{"description":"Invalid Access Token issuer/subject","errorCode":20103,"code":401,"status":"AUTHENTICATION_FAILED"}} 2018-12-12 14:08:06.352275+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009fc8000 | 12/12/14:08:06.352 | INFO | 1 | TNTwilsockClient | onMessageReceived, method = 3, id = TM029fdc4862ef459e9a769701bfb33e57 2018-12-12 14:08:06.352615+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009fc8000 | 12/12/14:08:06.352 | DEBUG | 3 | TNTwilsockClientImpl | proceedCloseMessage TM029fdc4862ef459e9a769701bfb33e57 2018-12-12 14:08:06.352959+0545 Caviar[38883:265062] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[3]: 0x700009fc8000 | 12/12/14:08:06.352 | INFO | 3 | TNTwilsockClientImpl | Server has just initiated process of closing connection! 401: AUTHENTICATION_FAILED 2018-12-12 14:08:06.353600+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:06.353 | DEBUG | 5 | TNWebsocket | Disconnected 2018-12-12 14:08:06.353921+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[4]: 0x70000a0ce000 | 12/12/14:08:06.353 | DEBUG | 1 | TNTwilsockClient | onDisconnected 2018-12-12 14:08:06.354306+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNInitialisingState[3]: 0x700009174000 | 12/12/14:08:06.354 | INFO | 10 | TNInitialisingState | Leaving state: Initialising 2018-12-12 14:08:06.354690+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.354 | INFO | 1 | TNTwilsockClient | Change state: Initialising --> TransportDisconnecting 2018-12-12 14:08:06.355052+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportDisconnectingState[3]: 0x700009174000 | 12/12/14:08:06.354 | INFO | 11 | TNTransportDisconnectingState | Entering state: TransportDisconnecting 2018-12-12 14:08:06.355389+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.355 | INFO | 1 | TNTwilsockClient | stopUpstreamRequests 2018-12-12 14:08:06.355758+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.355 | INFO | 1 | TNTwilsockClient | sendSuccessReplyImpl >> TransportDisconnecting 2018-12-12 14:08:06.356425+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportDisconnectingState[2]: 0x700009174000 | 12/12/14:08:06.355 | WARNING | 11 | TNTransportDisconnectingState | Success reply can not be sent. Twilsock is not in connected state 2018-12-12 14:08:06.356789+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.356 | INFO | 1 | TNTwilsockClient | closeRemotelyImpl >> TransportDisconnecting 2018-12-12 14:08:06.357224+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportDisconnectingState[2]: 0x700009174000 | 12/12/14:08:06.356 | WARNING | 11 | TNTransportDisconnectingState | Disconnect procedure has been already started 2018-12-12 14:08:06.357594+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.357 | INFO | 1 | TNTwilsockClient | onDisconnectedImpl >> TransportDisconnecting 2018-12-12 14:08:06.357950+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTransportDisconnectingState[3]: 0x700009174000 | 12/12/14:08:06.357 | INFO | 11 | TNTransportDisconnectingState | Leaving state: TransportDisconnecting 2018-12-12 14:08:06.358297+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.358 | INFO | 1 | TNTwilsockClient | Change state: TransportDisconnecting --> Disconnected 2018-12-12 14:08:06.358637+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNDisconnectedState[3]: 0x700009174000 | 12/12/14:08:06.358 | INFO | 2 | TNDisconnectedState | Entering state: Disconnected 2018-12-12 14:08:06.359056+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClientImpl[4]: 0x700009174000 | 12/12/14:08:06.358 | DEBUG | 3 | TNTwilsockClientImpl | notifyAboutDisconnected 2018-12-12 14:08:06.359398+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x700009174000 | 12/12/14:08:06.359 | INFO | 4 | TNHttpTransportClient | twilsock is in disconnected state: Unknown reason 2018-12-12 14:08:06.359734+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.359 | INFO | 1 | TNTwilsockClient | reset 2018-12-12 14:08:06.360059+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009174000 | 12/12/14:08:06.359 | DEBUG | 5 | TNWebsocket | ~TNWebsocket - begin 2018-12-12 14:08:06.360368+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009174000 | 12/12/14:08:06.360 | DEBUG | 5 | TNWebsocket | Reset session 2018-12-12 14:08:06.360797+0545 Caviar[38883:265064] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x70000a0ce000 | 12/12/14:08:06.360 | DEBUG | 5 | TNWebsocket | close 2018-12-12 14:08:06.361289+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNWebsocket[4]: 0x700009174000 | 12/12/14:08:06.361 | DEBUG | 5 | TNWebsocket | ~TNWebsocket - end 2018-12-12 14:08:06.361752+0545 Caviar[38883:265045] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNTwilsockClient[3]: 0x700009174000 | 12/12/14:08:06.361 | INFO | 1 | TNTwilsockClient | stopUpstreamRequests 2018-12-12 14:08:08.902759+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[4]: 0x700009692000 | 12/12/14:08:08.902 | DEBUG | 4 | TNHttpTransportClient | dequeueing request: RQ0d8131ae473a4cbe9613d64de0ed5543 2018-12-12 14:08:08.903385+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009692000 | 12/12/14:08:08.902 | DEBUG | 9 | TCHttpObserver | onFailed - begin 2018-12-12 14:08:08.903921+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[2]: 0x700009692000 | 12/12/14:08:08.903 | WARNING | 9 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-12-12 14:08:08.904339+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009692000 | 12/12/14:08:08.904 | DEBUG | 9 | TCHttpObserver | setPromise - 3 2018-12-12 14:08:08.904849+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009692000 | 12/12/14:08:08.904 | DEBUG | 7 | TCBackoffEmsClient | internal set token result: 3 2018-12-12 14:08:08.905283+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009692000 | 12/12/14:08:08.904 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:08.905364+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009921000 | 12/12/14:08:08.905 | DEBUG | 7 | TCBackoffEmsClient | internal set token run... 2018-12-12 14:08:08.906023+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009692000 | 12/12/14:08:08.905 | DEBUG | 9 | TCHttpObserver | onFailed - end 2018-12-12 14:08:08.906034+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009921000 | 12/12/14:08:08.905 | DEBUG | 8 | TCEmsClient | setToken 2018-12-12 14:08:08.906444+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009692000 | 12/12/14:08:08.906 | DEBUG | 9 | TCHttpObserver | ~TCHttpObserver - begin 2018-12-12 14:08:08.906444+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009921000 | 12/12/14:08:08.906 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:08.906949+0545 Caviar[38883:265047] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009692000 | 12/12/14:08:08.906 | DEBUG | 9 | TCHttpObserver | ~TCHttpObserver - end 2018-12-12 14:08:08.908533+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009921000 | 12/12/14:08:08.908 | DEBUG | 12 | TCHttpObserver | client: version: 2.5.1, build id: 243, build branch: refs/heads/master, os: ios, arch: x86_64 2018-12-12 14:08:08.910023+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x700009921000 | 12/12/14:08:08.909 | INFO | 4 | TNHttpTransportClient | requestId=RQ994fc04fbbb54472b491fd418afc2e94, enqueueing request to: https://ems.us1.twilio.com/v1/token 2018-12-12 14:08:08.910467+0545 Caviar[38883:265050] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009921000 | 12/12/14:08:08.910 | DEBUG | 8 | TCEmsClient | setToken - end 2018-12-12 14:08:13.911413+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[4]: 0x7000099a4000 | 12/12/14:08:13.911 | DEBUG | 4 | TNHttpTransportClient | dequeueing request: RQ994fc04fbbb54472b491fd418afc2e94 2018-12-12 14:08:13.911845+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x7000099a4000 | 12/12/14:08:13.911 | DEBUG | 12 | TCHttpObserver | onFailed - begin 2018-12-12 14:08:13.912261+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[2]: 0x7000099a4000 | 12/12/14:08:13.911 | WARNING | 12 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-12-12 14:08:13.912651+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x7000099a4000 | 12/12/14:08:13.912 | DEBUG | 12 | TCHttpObserver | setPromise - 3 2018-12-12 14:08:13.913072+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x7000099a4000 | 12/12/14:08:13.912 | DEBUG | 7 | TCBackoffEmsClient | internal set token result: 3 2018-12-12 14:08:13.913449+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x7000099a4000 | 12/12/14:08:13.913 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:13.913581+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009bb0000 | 12/12/14:08:13.913 | DEBUG | 7 | TCBackoffEmsClient | internal set token run... 2018-12-12 14:08:13.913797+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x7000099a4000 | 12/12/14:08:13.913 | DEBUG | 12 | TCHttpObserver | onFailed - end 2018-12-12 14:08:13.913994+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009bb0000 | 12/12/14:08:13.913 | DEBUG | 8 | TCEmsClient | setToken 2018-12-12 14:08:13.914160+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x7000099a4000 | 12/12/14:08:13.913 | DEBUG | 12 | TCHttpObserver | ~TCHttpObserver - begin 2018-12-12 14:08:13.914376+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009bb0000 | 12/12/14:08:13.914 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:13.914574+0545 Caviar[38883:265051] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x7000099a4000 | 12/12/14:08:13.914 | DEBUG | 12 | TCHttpObserver | ~TCHttpObserver - end 2018-12-12 14:08:13.916424+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009bb0000 | 12/12/14:08:13.916 | DEBUG | 13 | TCHttpObserver | client: version: 2.5.1, build id: 243, build branch: refs/heads/master, os: ios, arch: x86_64 2018-12-12 14:08:13.917566+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[3]: 0x700009bb0000 | 12/12/14:08:13.917 | INFO | 4 | TNHttpTransportClient | requestId=RQe8796be7ca60460fa0aea8cb8c85ff9f, enqueueing request to: https://ems.us1.twilio.com/v1/token 2018-12-12 14:08:13.918031+0545 Caviar[38883:265054] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009bb0000 | 12/12/14:08:13.917 | DEBUG | 8 | TCEmsClient | setToken - end 2018-12-12 14:08:18.918769+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TNHttpTransportClient[4]: 0x700009cb6000 | 12/12/14:08:18.918 | DEBUG | 4 | TNHttpTransportClient | dequeueing request: RQe8796be7ca60460fa0aea8cb8c85ff9f 2018-12-12 14:08:18.919434+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009cb6000 | 12/12/14:08:18.919 | DEBUG | 13 | TCHttpObserver | onFailed - begin 2018-12-12 14:08:18.919870+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[2]: 0x700009cb6000 | 12/12/14:08:18.919 | WARNING | 13 | TCHttpObserver | Request has failed: Transport connection closed (3) 2018-12-12 14:08:18.920409+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009cb6000 | 12/12/14:08:18.920 | DEBUG | 13 | TCHttpObserver | setPromise - 3 2018-12-12 14:08:18.920840+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009cb6000 | 12/12/14:08:18.920 | DEBUG | 7 | TCBackoffEmsClient | internal set token result: 3 2018-12-12 14:08:18.921300+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[3]: 0x700009cb6000 | 12/12/14:08:18.920 | INFO | 7 | TCBackoffEmsClient | backoff result: 2 - 'Time is exceeded', setToken result: 3 2018-12-12 14:08:18.921719+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCBackoffEmsClient[4]: 0x700009cb6000 | 12/12/14:08:18.921 | DEBUG | 7 | TCBackoffEmsClient | scheduleSetToken 2018-12-12 14:08:18.922133+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCEmsClient[4]: 0x700009cb6000 | 12/12/14:08:18.921 | DEBUG | 8 | TCEmsClient | runGenerateTokenTask 2018-12-12 14:08:18.922595+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009cb6000 | 12/12/14:08:18.922 | DEBUG | 13 | TCHttpObserver | onFailed - end 2018-12-12 14:08:18.923042+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009cb6000 | 12/12/14:08:18.922 | DEBUG | 13 | TCHttpObserver | ~TCHttpObserver - begin 2018-12-12 14:08:18.923483+0545 Caviar[38883:265056] <<<<TwilioChatClient: 0x7f975be3c930>>>> TCHttpObserver[4]: 0x700009cb6000 | 12/12/14:08:18.923 | DEBUG | 13 | TCHttpObserver | ~TCHttpObserver - end 2018-12-12 14:08:18.923928+0545 Caviar[38883:264873] <<<<TwilioChatClient: 0x7f975be3c930>>>> Chat-iOS[0]: 0x70000960f000 | 12/12/14:08:18.921 | FATAL | Chat-iOS | Error validating token: 3

berkus commented 5 years ago

Lets start with generating a proper token:

    "ip_messaging": {   <-- change this to "chat"
      "service_sid": "IS96a2a102aeb8489ab0e14005f158ea1e",
      "endpoint_id": "Caviar:prakash@gmail.com:A6DA3791-FFBF-45A7-B198-3DD3E1A75B10", <-- remove endpoint_id completely
      "push_credential_sid": "-" <-- if you do not have push credentials, remove this field too; specify it only if push credential exists.
    }
chetanzala commented 5 years ago

because of time limit in project we move from TwilioChatClient.

On Wed, Dec 12, 2018 at 2:17 PM Berkus Decker notifications@github.com wrote:

Lets start with generating a proper token:

"ip_messaging": {   <-- change this to "chat"
  "service_sid": "IS96a2a102aeb8489ab0e14005f158ea1e",
  "endpoint_id": "Caviar:prakash@gmail.com:A6DA3791-FFBF-45A7-B198-3DD3E1A75B10", <-- remove endpoint_id completely
  "push_credential_sid": "-" <-- if you do not have push credentials, remove this field too; specify it only if push credential exists.
}

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twilio/twilio-chat-demo-ios/issues/35#issuecomment-446508479, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQH0RrgBzOS8keIE1ZeXJJt9E4tV7M1ks5u4MK7gaJpZM4RY9vv .

-- Chetansinh Zala iOS TEAM LEAD Prismetric Technologies Pvt Ltd.

Anushka3174 commented 5 years ago

Okay, we changed the 'ip_messaging' to chat; removed endpoint as well as the push credential. We are still getting the same issue. We are using this token from ios eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2RlMzllYThhOWQyYjhjZmE2YjgzNjEyMzRjZWYxYmU1LTE1NDQ2MDc1MzgiLCJncmFudHMiOnsiY2hhdCI6eyJzZXJ2aWNlX3NpZCI6IklTOTkyNjhhZTA4OGYxNDliYWE1MjAyZDdiZTViY2I5MTUiLCJlbmRwb2ludF9pZCI6IjVjMGY4MDdiNGJiNmE5MGNiYWQ5NDZiZTo1YzBmODA3YjRiYjZhOTBjYmFkOTQ2YmUifX0sImlhdCI6MTU0NDYwNzUzOCwiZXhwIjoxNTQ0NjExMTM4LCJpc3MiOiJTS2RlMzllYThhOWQyYjhjZmE2YjgzNjEyMzRjZWYxYmU1Iiwic3ViIjoiQUM2MmRhODI0NjRlNzg3ZDQ1YmMwODNmYmI3ZWM0MGFlNCJ9.SevI4OPzKQ4-McnKQlJlqBTaoXAveeSx9raNmD_gC8c

Our code from iOS:-

TwilioChatClient.chatClient(withToken: token, properties: nil, delegate: self) { (result, chatClient) in self.client = chatClient; // Update UI on main thread

    if self.isChatExist{
           let options = [
               //            TCHChannelOptionFriendlyName: “General Channel”,
               TCHChannelOptionUniqueName:self.chatChannelName,
               TCHChannelOptionType: TCHChannelType.private.rawValue
               ] as [String : Any]

           if let client = self.client, let channelsList = self.client?.channelsList() {
               channelsList.createChannel(options: options, completion: { channelResult, channel in
                   if (channelResult.isSuccessful()) {
                       print(“Channel created.“)
                   } else {
                       print(“Channel NOT created.“)
                   }
               })
           }
       }

       let channel = self.client?.channelsList()?.channel(withSidOrUniqueName: self.chatChannelName, completion: { (tchResult, tchChannel) in
           self.generalChannel =   tchChannel
           tchChannel?.join(completion: { channelResult in
               if channelResult.isSuccessful() {
                   print(“Channel joined.“)
               } else {
                   print(“Channel NOT joined.“)
               }
           })
       })
       DispatchQueue.main.async() {
           self.navigationItem.prompt = “Logged in as \“\(self.identity)\“”
       }
   }

In line 3, we assign self.client= chatClient; the value of chatClient comes nill from the Twilio SDK. FYI, we are using following Twillio sdk:-

berkus commented 5 years ago

You seem to still have endpoint_id in your token?

berkus commented 5 years ago

Also {"description":"Invalid Access Token issuer/subject","errorCode":20103,"code":401,"status":"AUTHENTICATION_FAILED"}} It looks like you sign your token with an incorrect signing key (do NOT publish it here, because we will have to block your account if you do, for security reasons). But double check that your SKxxx key and it's corresponding signing key actually match.

You can use jwt.io and enter your signing key in the signature field to see it matches the encryption key (this happens on the client side so is relatively safe), then validate in the twilio console that the SKxxxx key uses exactly this key and not some other. Check that your ACxxx account also matches the SKxxx key.

What you have here is a mismatch between the issuer (SKxxx) and subject (ACxxx) of the token, and possibly an invalid signature (that's mismatch between SKxxx and it's signing secret key).

berkus commented 5 years ago

No response for a while, closing.