当身份验证失败时,SimpleAuthorizationServerProvider
的GrantResourceOwnerCredentials方法返回;
context.SetError("invalid_grant", "The user name or password is incorrect.");
但是,我需要使用TEntity
类返回自己的JSON响应,我们将不胜感激。
答案 0 :(得分:1)
这会为你做到这一点吗?
context.SetError("MyCustomError", JsonConvert.SerializeObject(new removeit()
{
NAME = "1",
name2 = "2",
name3 = "3"
}));
返回
{
"error": "MyCustomError",
"error_description": "{\"NAME\":\"1\",\"name2\":\"2\",\"name3\":\"3\"}"
}