Example #1
0
        public async Task Logout()
        {
            var uri = $"{baseUri}api/user/Account/Logout";

            using (var myClient = new HttpClient())
            {
                myClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", CrossSecureStorage.Current.GetValue("Token"));
                var response = await myClient.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    CrossSecureStorage.Current.DeleteKey("Token");

                    using (var controller = new SQLiteController())
                    {
                        controller.DeleteUserFromLocalDb();
                    }
                }
            }
        }