Ejemplo n.º 1
0
        public async Task <ActionResult> CreateToken([FromBody] User attempt)
        {
            var user = await _authService.Authenticate(attempt);

            if (user != null)
            {
                var tokenString = _authService.BuildToken(user);
                return(Ok(new { token = tokenString, userId = user.id }));
            }

            return(ValidationProblem());
        }