예제 #1
0
        public async Task <ActionResult <ApiResponse <JwtToken> > > Authenticate([FromBody] LoginUserViewModel data)
        {
            _authService.ValidateLogin(data);

            JwtToken result = await _auth.AuthenticateUserAsync(data);

            if (result == null)
            {
                throw new WebApiApplicationException(StatusCodes.Status401Unauthorized, ErrorMessages.InvalidUser, MethodBase.GetCurrentMethod().GetParameters());
            }
            //return StatusCode(StatusCodes.Status401Unauthorized, "Invalid username or password", null);

            return(Ok(result, InfoMessages.UserSignin));
        }