How to register / update users when already authenticated

Hi guys,
I would like to register / update users while already authenticated. The idea is to log in as admin and, from a “Add/edit user” page, create / edit my users.

My apphost has registration feature

Plugins.Add(new RegistrationFeature());

But when I try to register a new user (using Register route) I get this error:

Updating existing User is not enabled. Sign out to register a new User.

What should I do?

Creation request is this:

  getClient(): JsonServiceClient {
    var client = new JsonServiceClient(environment.apiUrl);
    client.credentials = "omit";
    return client;

  async register(user: User) {

    var client = this.getClient();
    var request = new Register();
    request.UserName = user.username;
    request.Password = user.password;
    request.FirstName = user.firstName;
    request.LastName = user.lastName;
    try {
      return await<RegisterResponse>(request)
    catch (e) {
      throw this.getError(e); 

  getError(e: any) {
    return e.responseStatus.message;

Thanks Enrico

Check out the Auth Repository docs.

E.g. You could enable the same backend User Management APIs that Studio User Admin UI module uses to manage users with:

Plugins.Add(new AdminUsersFeature());

Which enables these Admin User APIs which Admin users can use to Create/Update/Delete Users remotely.

Inside ServiceStack, you can update users using the Auth Repository APIs, e.g:

await base.AuthRepositoryAsync.UpdateUserAuthAsync(...);

Or you can update the UserAuth tables directly, e.g:

Db.UpdateOnly(() => new UserAuth { DisplayName = newName }, 
    where: q => q.Id == userId);

Perfect, it works. Thank you

There is another things I would like to ask you: my IAuthRepository is registered this way

            container.Register<IAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>())
                UseDistinctRoleTables = true

If I understand the meaning of UseDistinctRoleTables property, in this way I should use table UserAuthRole to manage roles and permission, but when I try to do it by using the AssignRoles route I receive the InvalidRoleException even if my admin has “Admin” in its role field in the UserAuth tables.
Do I have to add the admin role for admin user in the UserAuthRole table instead?

Best regards

Right it means the Roles are stored in a separate UserAuthRole instead of with the UserAuth, in which case you’ll need to use the IManageRoles APIs to manage User Roles.