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";
client.setBearerToken(this.bearertoken);
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 client.post<RegisterResponse>(request)
}
catch (e) {
throw this.getError(e);
}
}
getError(e: any) {
return e.responseStatus.message;
}
Thanks Enrico