Custom Auth Repository - using string ids

I’ve made a custom auth repository modeled off of other auth repositories. I’m using it in combination with the credentials auth provider and found an issue today regarding the PopulateSession method.

Seems this provider (and perhaps all the providers?) require an integer user auth id now?

Even though my auth repository is using the correct string Id for my user DTOs - the credentials auth provider is forcing the use of the IUserAuth.Id to get auth details (which already exist) for the session information.

public void PopulateSession(IUserAuthRepository authRepo, IUserAuth userAuth, IAuthSession session)
        {
            if (authRepo == null)
                return;

            var holdSessionId = session.Id;
            session.PopulateWith(userAuth); //overwrites session.Id
            session.Id = holdSessionId;
            session.IsAuthenticated = true;
            session.UserAuthId = userAuth.Id.ToString(CultureInfo.InvariantCulture);
            session.ProviderOAuthAccess = authRepo.GetUserAuthDetails(session.UserAuthId)
                .ConvertAll(x => (IAuthTokens)x);
        }

in my case I am using string ids for users so userAuth.Id is 0 - causing issues with everything that uses session.UserAuthId

I am assuming in order for this to work I’ll need to write a subclass of AuthProvider which populates session.UserAuthId differently?

After some debugging - found the reason for login failures was JwtAuthProvider failing to get permission and role information using UserAuthId of 0 here: https://github.com/ServiceStack/ServiceStack/blob/1bb9046cbc1fdb7b9a3a5fdffffe673565c3d45b/src/ServiceStack/Auth/JwtAuthProvider.cs#L422

I removed IManageRoles from my AuthRepository and authentication works again - though UserAuthId is still 0 instead of the string id as it should be

The UserAuthId is a reference to the User Info stored within the UserAuth table which is an int Id.