Exemplo n.º 1
0
        private void SignIn(TmsAuthenticationRequest body)
        {
            Log.Debug("Signing in");
            ClearSession();
            var request = new RestRequest("/tmsapi/authenticate");

            request.AddJsonBody(body);

            var response = Client.Post <ResponseBase <AuthenticationDataResponse> >(request);

            if (!response.IsSuccessful)
            {
                Log.Error(response.Content);
                throw new AuthenticationException(response.Data.Message);
            }
            AuthData = response.Data.Data;
            CookieUtils.ParseCookies(response, Client.CookieContainer, Client.BaseUrl);
            SaveSession();
            IsAuthenticated = true;
            Log.Debug("Signed In");
        }