private static void HandleRefreshCallback <TRequest, TResponse>(IWebCall <TRequest, TResponse> webCall, bool needAuthToken, string authToken, bool needSession, IWebCallEncryptor webCallEncryptor) where TRequest : BaseUserRequest where TResponse : BaseResponse, new() { if (needAuthToken && authToken != null) { webCall.SetHeader("X-Mix-OneIdToken", authToken); } if (needSession && webCallEncryptor != null) { webCall.WebCallEncryptor = webCallEncryptor; webCall.SetHeader("X-Mix-UserSessionId", webCallEncryptor.SessionId); } if (webCall.RefreshStatus == WebCallRefreshStatus.WaitingForRefreshCallback) { webCall.RefreshStatus = WebCallRefreshStatus.NotRefreshing; bool flag = true; if (needAuthToken && authToken == null) { flag = false; webCall.DispatchError("GuestController token expired and couldn't get a new token"); } if (needSession && webCallEncryptor == null) { flag = false; webCall.DispatchError("Session expired and couldn't start a new session"); } if (flag) { webCall.Execute(); } } else { webCall.RefreshStatus = WebCallRefreshStatus.RefreshedWhileWaitingForCallback; } }