public async Task <IActionResult> Login([FromBody] Account account, CancellationToken cancellationToken) { Guard.Argument(account.Email, nameof(account.Email)).NotNull(); Guard.Argument(account.Password, nameof(account.Password)).NotNull(); var storageAccount = await _accountManager.AuthenticateAsync(account, cancellationToken); if (storageAccount == null) { return(BadRequest(new { message = "Username or password is incorrect" })); } string tokenString = GetAuthToken(storageAccount); // return basic user info and authentication token return(Ok(new { storageAccount.Email, storageAccount.Name, Token = tokenString })); }