Example #1
0
        public async Task <ActionResult <dynamic> > Authenticate([FromBody] User model)
        {
            var response = _userManager.FindByEmailAsync(model.UserName);

            if (response != null)
            {
                var usuario = (IdentityUser)response.Result;

                var token = TokenServices.GenerarateToken(usuario);

                return(new
                {
                    user = usuario,
                    token = token,
                });
            }

            return(null);
        }