public async Task <ActionResult> Post(string email)
        {
            Console.WriteLine(email);
            var createToken = await _handler.Create(email);

            Console.WriteLine(createToken.Token);
            await _handler.PostTrailActivity(new TrailResponse("200", "Successful", "Error"), "Create Token");

            return(new OkObjectResult(new { Token = createToken.Token, Email = createToken.Email }));;
        }
        private async Task <OAuthToken> GetTokenAsync(UserAccount userAccount) //ToDo: think about update claim information in token
        {
            _logger.InitMethod(nameof(GetTokenAsync), $"[UserAccount.Id] {userAccount.Id}");

            var principal = await _signInManager.CreateUserPrincipalAsync(userAccount); //ToDo: avatar, languages

            var identity = (ClaimsIdentity)principal.Identity;

            _logger.LogInformation("user claims: " + identity?.Claims.ToJson());

            if (identity == null)
            {
                return(null);
            }

            var token = _tokenHandler.Create(_configuration["Token:Key"], int.Parse(_configuration["Token:LifeTimeInMinutes"]), identity.Claims);

            _logger.LogInformation($"token successfully created | rTokenLength: {token.RefreshToken.Length} | aTokenLength: {token.AccessToken.Length}");

            return(token);
        }
        public async Task <LoginQueryResponse> Handle(LoginQuery request, CancellationToken cancellationToken)
        {
            var view = await _collection.Find(x => x.Id == request.Id).FirstOrDefaultAsync(cancellationToken);

            if (view == null)
            {
                throw new ItemNotFoundException($"Account with username {request.Id} not found");
            }

            var isAuthorized = _passwordComputer.Compare(request.Password, view.Password);

            if (!isAuthorized)
            {
                throw new UnauthorizedAccessException("Password incorrect.");
            }

            var token = _tokenHandler.Create(request.Id);

            return(new LoginQueryResponse(view.Id, view.BuddyId, token));
        }