public async Task <ActionResult <object> > Login([FromForm] string userName, [FromForm] string password) { if (String.IsNullOrEmpty(userName)) { return(new { msg = "userName can't be null" }); } if (String.IsNullOrEmpty(password)) { return(new { msg = "password can't be null" }); } var isValid = userName == "admin" && password == "pass"; if (!isValid) { return(Ok(new { success = false, msg = "userName or password is not valide" })); } TokenResponse res = await _tokenUtil.AuthorizeClientAsync(_userManager, _signInManager, userName, password); return(Ok(new { success = true, token = res.AccessToken, refreshToken = res.RefreshToken, expiresIn = res.ExpiresIn })); }