Add user without sending an email invitation

Hello N8N team,

I think it’s a bit difficult to setup SMTP just to add users.
How about having a simple way to add users without sending invitation.

Thanks

If you’re comfortable working with the DB, you can just insert users into the users table. You should only need the firstname, lastname, email and a randomly generated UUID.

To generate a uuid you can use uuidgen, or an online service:

$ uuidgen
E0ADC782-0260-4207-AADD-513413E45C94

If you want to set the password for them you just need to generate a bcrypt hash which you can do with htpasswd or an online service:

$ htpasswd -bnBC 10 "" 'myLongSecurePassword' | tr -d ':\n'
$2y$10$14JMVmvcLtvbvmpPnmgBTuzp/GhMnG.VFQC.dNq4yMVjeXyQEL6lK

Taking postgres as an example a query to insert a new “member” user without password (they can create one with the forgot password functionality):

INSERT INTO public."user"
(id, email, "firstName", "lastName", "globalRoleId")
VALUES('E0ADC782-0260-4207-AADD-513413E45C94', '[email protected]', 'my', 'user', 2);

To insert the user with your predefined password:

INSERT INTO public."user"
(id, email, "firstName", "lastName", "globalRoleId", "password")
VALUES('E0ADC782-0260-4207-AADD-513413E45C94', '[email protected]', 'my', 'user', 2, '$2y$10$14JMVmvcLtvbvmpPnmgBTuzp/GhMnG.VFQC.dNq4yMVjeXyQEL6lK');
3 Likes

This is definitely useful
I will give it a try

Thanks