How to create a 8Base User with a role through a GraphQL mutation?

I’m working on an app using 8Base Users with Auth0. Login and registration is all possible and I can make any changes from the dashboard successfully.

One thing that I am trying to do from a React / GraphQL based app is write a mutation that will create a user with a pre-defined user role that I created in the 8Base dashboard. Right now, any user that signs up has “Guest” and “Administrator” by default, but I added an additional role called “Member”.

What would the mutation look like for a user that has the “Member” role? Here’s what I have so far with my User table having a Roles column (currently associated with Users table because I don’t know what else to try):

mutation SignUp(
  $email: String!
  $firstName: String!
  $lastName: String
  $password: String!
  $authProfileId: ID!
  $roleId: ID!
) {
userSignUpWithPassword(
  user: {
    email: $email
    firstName: $firstName
    lastName: $lastName
    roles: { connect: [{ id: $roleId }] }
  }
  password: $password
  authProfileId: $authProfileId
) {
  id
  email
  createdAt
  }
}

Hi there, when you use the userSignUpWithPassword mutation, you are setting the authProfileId. That Authentication Profile is where you’re able to set the roles that are added to a user once they sign up.

Otherwise, if it worked like this, and new user could technically assign themselves any roles they want.

So simply take roles: { connect: [{ id: $roleId }] } OUT of your mutation and add the Member role to your authentication profiles settings.