Send Invitation with admin plugin #2098

Open
opened 2026-03-13 09:26:51 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @RVP97 on GitHub (Oct 9, 2025).

It would be great to be able to invite a user to the app using the admin plugin. Right now it is only able to do it via the organization plugin. For example, a company app has an admin user that needs to invite other non admin users to the dashboard. Signups are disabled so no one without an invite can access it (many have Gmail so not enable to enforce company domain). And create user using admin plugin is also not great since you have to set a password for the other person. Would be great to have something like authClient.admin.inviteUserByEmail to be able to send invitations. In this example organization plugin does not make sense since there is only one organization and will never be more than one

Originally created by @RVP97 on GitHub (Oct 9, 2025). It would be great to be able to invite a user to the app using the admin plugin. Right now it is only able to do it via the organization plugin. For example, a company app has an admin user that needs to invite other non admin users to the dashboard. Signups are disabled so no one without an invite can access it (many have Gmail so not enable to enforce company domain). And create user using admin plugin is also not great since you have to set a password for the other person. Would be great to have something like authClient.admin.inviteUserByEmail to be able to send invitations. In this example organization plugin does not make sense since there is only one organization and will never be more than one
GiteaMirror added the enhancement label 2026-03-13 09:26:51 -05:00
Author
Owner

@ueryooo commented on GitHub (Dec 22, 2025):

I also faced the same issue. After investigating, I confirmed that the Admin plugin currently does not have an inviteUser or similar invitation functionality.

As a workaround, I'm using the following approach:

  1. Create user with admin.createUser (with a dummy password since it's required)
  2. Send a magic link using signInMagicLink for the user to log in

This works, but having a built-in admin.inviteUserByEmail would be much cleaner.

Related discussion with various workarounds: #4223

@ueryooo commented on GitHub (Dec 22, 2025): I also faced the same issue. After investigating, I confirmed that the Admin plugin currently does not have an `inviteUser` or similar invitation functionality. As a workaround, I'm using the following approach: 1. Create user with `admin.createUser` (with a dummy password since it's required) 2. Send a magic link using `signInMagicLink` for the user to log in This works, but having a built-in `admin.inviteUserByEmail` would be much cleaner. Related discussion with various workarounds: #4223
Author
Owner

@vcode-sh commented on GitHub (Feb 20, 2026):

Shipped a plugin that handles this — admin-managed invitations with full CRUD: create, list, revoke, resend, delete, stats. Pluggable email callback so you bring your own Resend/Postmark/SES/whatever.

Also does the thing no other plugin does — actually blocks signups without a valid code.

npm install better-auth-invitation-only

GitHub: https://github.com/vcode-sh/better-auth-invitation-only

@vcode-sh commented on GitHub (Feb 20, 2026): Shipped a plugin that handles this — admin-managed invitations with full CRUD: create, list, revoke, resend, delete, stats. Pluggable email callback so you bring your own Resend/Postmark/SES/whatever. Also does the thing no other plugin does — actually blocks signups without a valid code. `npm install better-auth-invitation-only` GitHub: https://github.com/vcode-sh/better-auth-invitation-only
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2098