Maybe it’s too late, but here is the solution:
Go to ./extensions/users-permissions/config/schema.graphql.js
create the file if it doesn’t exist
add this
module.exports = {
definition: `
extend input UsersPermissionsRegisterInput {
role: String!
}
`,
type: {},
resolver: {},
};
Then, the registration will accept the role string value.
Do you logic to search roles by name, then get the target role id in the beforeCreate and update the new user’s role.