// GET: Authenticate/Edit/5 public async Task <ActionResult> Authenticate([FromBody] User auth, [FromQuery] Guid application) { if (auth == null || application == null) { return(StatusCode((int)HttpStatusCode.NotAcceptable)); } var user = await _tokenManager.AuthenticateAsync(auth, application); if (user == null) { return(BadRequest(new { message = "Username or password is incorrect" })); } _tokenManager.SaveToken(user, application); return(Ok(user)); }