public IHttpActionResult Authenticate([FromBody] LoginRequest login) { if (login == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } //TODO: Validate credentials Correctly, this code is only for demo !! //bool isCredentialValid = (login.Password == "123456"); UsuarioBL usuarioBl = new UsuarioBL(); bool isCredentialValid = usuarioBl.CompraraContraseña(new DAL.Tbl_Usuarios() { Usuario = login.Username, Password = login.Password }).ejecucion; if (isCredentialValid) { var token = TokenGenerator.GenerateTokenJwt(login.Username); return(Ok(token)); } else { return(Unauthorized()); } }