public async Task <IActionResult> Registration(AccountCreateRequest request) { var newUser = await _accountManager.AddUserAsync(request.Email, request.Password, request.FirstName, request.LastName); if (newUser) { var identity = await _accountManager.GetIdentityAsync(request.Email, request.Password); var jwt = _accountManager.GetToken(identity); var response = new { access_token = jwt, username = identity.Name }; return(Json(response)); } else { return(BadRequest(new { errorText = "Thу user with this e-mail is already registered" })); } }