Custom error message from TryAuthenticate in CredentialsAuthProvider

Hi everyone!

I need send custom error code and message form TryAuthenticate().
I don’t know how send custom response.

Help me please, how can I do this?

Thanks in advance!

You should be able to throw a HttpError, e.g:

throw HttpError.Unauthorized("Custom error message");

throw new HttpError(HttpStatusCode.Unauthorized, "Custom error message");