У меня есть этот код: [code]public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { var identity = new ClaimsIdentity(context.Options.AuthenticationType);
using (UserAuthentication objUser = new UserAuthentication()) { //var user = db.ApiUsers.Where(o => o.UserName == context.UserName && o.UserPasswd == context.Password).FirstOrDefault(); var user = objUser.ValidateUser(context.UserName, context.Password); if (user == "false") { context.SetError("invalid_grant", "Username or password is incorrect"); if(context.ErrorDescription == "Username or password is incorrect") {
} context.Response.StatusCode = 200;
return; } else { identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName)); await Task.Run(() => context.Validated(identity)); } } } [/code] который имеет такой вывод: [code]{ "error": "invalid_grant", "error_description": "Username or password is incorrect" } [/code] Но вывод должен выглядеть так: [code]{ "Message": "invalid_grant", "Message_Description": "Username or password is incorrect" } [/code] Как мне этого добиться?