Ejemplo n.º 1
0
        public async Task <bool> Login(string login, string password)
        {
            try
            {
                var tokenResponse = await(await _accountClient).LoginAsync(new LoginRequest()
                {
                    Login    = login,
                    Password = password
                });

                if (tokenResponse.ResultCase == LoginResponse.ResultOneofCase.Login)
                {
                    var token = tokenResponse.Login.Token;
                    Console.WriteLine(token);
                    await _localStorage.SetItemAsync("token", token);

                    _authenticationStateProvider.MarkUserAsAuthenticated(token);

                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public async Task <bool> Login(string login, string password)
        {
            var token = "dfdfdferwrr";


            await _localStorage.SetItemAsync("token", token);

            _authenticationStateProvider.MarkUserAsAuthenticated(token);

            return(true);
        }