This question is locked. New answers and comments are not allowed.
Having problems with authentication Roles in the .NET SDK:
- Cannot set a Role when creating a new user. I must include a Role.Id in the new User, but it is ignored; all users are created with the Role "Registered".
- Cannot change the Role for an existing user. No error is given when using the example UpdateUserById code, but the user.RoleId does not change. Other values such as user.Email can be changed by this method.
- Cannot add a new role. Am getting the error "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)". I though the Id would be created by the Backend Services.
Here is my code for trying to add a new role:
Role newRole =
new
Role() {
Name =
"Gibbergoo"
,
};
CreateResultItem cri = await CreateRoleAsync(
new
Guid(everliveApp.AppSettings.ApiKey), newRole, masterKey);
- - - - -
public
async Task<CreateResultItem> CreateRoleAsync(Guid applicationId, Role newRole,
string
masterKey) {
var metadata =
new
EverliveAccount(
new
EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
return
await metadata.WorkWith().Application(applicationId).Roles().Create(newRole).ExecuteAsync();
}