Exemple #1
0
        public async Task <bool> SignInAsync(string login, string password)
        {
            var getTokenPairQuery = new GetTokenPairQuery
            {
                Login    = login,
                Password = password
            };

            JwtTokenPair tokenPair = await _mediator.Send(getTokenPairQuery);

            if (tokenPair != null)
            {
                await _localStorage.SetAccessTokenAsync(tokenPair.AccessToken);

                await _localStorage.SetRefreshTokenAsync(tokenPair.RefreshToken);

                var activateRefreshTokenCommand = new ActivateRefreshTokenCommand
                {
                    RefreshToken = tokenPair.RefreshToken,
                    Thumbprint   = "12345" // TODO: make HWID
                };

                await _mediator.Send(activateRefreshTokenCommand);

                return(true);
            }

            return(false);
        }