Facebook Authentication error after upgrading to v.5.7

Hi,
I have a legacy .net framework app that I am migrating to .net core platform. After upgrading to the version 5.7 of ServiceStack the android client cannot authenticate with facebook.

This is the server response:

{“ResponseStatus”:{“ErrorCode”:“NotEmpty”,“Message”:"‘User Name’ must not be empty.",“Errors”:[{“ErrorCode”:“NotEmpty”,“FieldName”:“UserName”,“Message”:"‘User Name’ must not be empty.",“Meta”:{“PropertyName”:“User Name”}}]}}

The request is a POST to the /auth endpoint with these fields:

dto.Authenticate authenticate = new dto.Authenticate()
.setProvider(Const.AUTH_PROVIDER_FACEBOOK)
.setAccessToken(facebookAccessToken)
.setRememberMe(true);

Is it now mandatory to add the username in the authentication request?
I have not found any references to this breaking change in the release notes.

PS: I had the same problem with the logout endpoint. If I don’t send the username the request is rejected.

Odd, can you Post the raw HTTP Request/Response sent using Fiddler or WireShark please?

Ok, I found the issue:

I have a custom CredentialAuthProvider that inherits the default CredentialProvider. Inside this class there is a private validator:

private class MyAuthValidator : AbstractValidator
{
public MyAuthValidator()
{
RuleFor(x => x.UserName).NotEmpty();

Other rules
}
}

The auth request fire this validator with all providers, even if it is declared as private. This only happens with the latest ss versions.

If I disable the validation feature on Startup or I delete the private validator, everything works as it should

1 Like