Creating a new user through API

System Information
  • Strapi Version:
  • Operating System:
    Windows - production is Heroku
  • Database:

I am trying to create a new frontend user through an API.
I am able to add a new entry to to the user model with entityService but then I can’t log on with that user.

I have tried about 50 different things and been searching Google for about 20 hours already but I can’t find the answer. I am currently searching through the Github and node_modules.

Here is my code:

      const pw = await auth.hashPassword("testtest");
      let newUser = await strapi.entityService.create(
          data: {
            username: Email,
            email: Email,
            password: pw,
            provider: 'local',
            confirmed: true,
            OrganizationName: OrganizationName,
            OrganizationId: organizationId,
            TypeOfRegistration: "Admin",
            FullName: Name,
            UserId: uuidv4(),
1 Like

I found the solution:

const res = await strapi.entityService.create(
          data: {
            username: 'your-user-name',
            provider: 'local',
            blocked: false,
            password: 'raw-password',
            role: 3,
1 Like