User2130689380 posted
I have same problem like this . But when I try this code
public static class ContextHelper
{
public static void SetCustomError(this OAuthGrantResourceOwnerCredentialsContext context, string errorMessage, bool status)
{
var json = new ErrorMessage(errorMessage, status).ToJsonString();
//context.SetError(json);
context.Response.Write(json);
}
public static string ToJsonString(this object obj)
{
return JsonConvert.SerializeObject(obj);
}
}
public class ErrorMessage
{
public ErrorMessage(string message, bool status)
{
Message = message;
Status = status;
}
public string Message { get; private set; }
public bool Status { get; private set; }
}
if (user == null)
{
ContextHelper.SetCustomError(context, "Provided username and password is not matching, Please retry.", false);
return;
}
I get "syntax error". Because text response is:
{"access_token":null,"message":"The user name or password is incorrect"}{"error":" "}
I can't remove {"error":" "}
is there any way to remove {"error":" "}