How do I refresh the login token correctly?

I’m Creating a video viewer application based on the “TcpVideoViewer” sample. Every time I try to refresh the token I receive the following error:

Error refreshing token: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail

After some further testing, I noticed the same issue occurs in the sample code.

Is there something else that needs to be done to refresh the token that is not shown in the sample?

This is a known issue. Here is a workaround comment from Milestone Development.

This problem is best resolved by inserting the following line between lines 39 and 40 in ProtocolSamples/TcpVideoViewer/WindowMain.xaml.cs

TokenString = e;
_sysInfo.LoginInfo.Token = TokenString; // insert this line
NotifyPropertyChanged("TokenString");

Thank you for the response. I tested the workaround, unfortunately, I’m still running into the same issue.

Can you please test using TcpVideoViewer sample (I mean, not your viewer application) with the code that I wrote in the previous conversation?

I ran the test over the weekend and I’m still getting the same error:

System.Exception: "Error refreshing token: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail."

The error occurs in line 212 of “NtlmConnection.cs”. This always happens after 4 hours.

Please try to debug using a shortened token timeout, this will enable you to debug without having to spend the night, please see - https://developer.milestonesys.com/s/article/modify-XProtect-Advanced-and-XProtect-Plus-token-timeout-value-to-avoid-Invalid-Token

Can you please try again and this time give us the inner exception?

how can i set the token timeout??? thanks.

Please see this KB – MODIFY XPROTECT ADVANCED VMS TOKEN TIMEOUT VALUE TO AVOID ‘INVALID TOKEN’ ERROR

https://developer.milestonesys.com/s/article/modify-XProtect-Advanced-and-XProtect-Plus-token-timeout-value-to-avoid-Invalid-Token