예제 #1
0
        /// <summary>
        /// Logs the user out
        /// </summary>
        /// <returns></returns>
        public async Task SignOut()
        {
            if (Helper.IsInternetAvailable())
            {
                var result = await ApiWrapper <string> .Post(Api.Account.LogOut, null);
            }

            // Reset some properties
            SecureStorage.Remove(SecureStorageProperties.AccessToken);
            Preferences.Remove(PrivateSettings.AccessTokenExpiryDate);
            Preferences.Set(PrivateSettings.IsLoggedIn, false);
        }
예제 #2
0
        private async Task <Tuple <SignInResponseDTO, string> > GetAuthenticationTokenAsync(string username, string password)
        {
            if (Helper.IsInternetAvailable())
            {
                var request = new SignInRequestDTO
                {
                    Username  = username,
                    Password  = password,
                    GrantType = "password",
                };
                var result = await ApiWrapper <SignInResponseDTO> .Post(Lib.Api.Account.Token, request, false);

                return(result);
            }

            return(null);
        }