Get Started

Basic Usage

Getting started with the invite plugin.

GitHubSourcenpmNpm

Creating an invite

To invite a user to our application, we need to create an invite. We can create a public or private invite:

  • If the invite has an email the user will get an invite email and the invite will be private, meaning only that user can use that invite.
  • But if no email is present when creating the invite, the invite will be public, and the user that created the invite will receive the invite url or token to share.
POST
/create-invite
All parameters default to the plugin's options defaults, except for role and email.
const { data, error } = await authClient.createInvite({    role, // Required    email, // If email is present, the invite is private    tokenType,    redirectToSignUp,    redirectToSignIn,    maxUses,    expiresIn,    redirectToAfterUpgrade,    shareInviterName,    senderResponse,    senderResponseRedirect,});

Prop

Type

Activating an invite

POST
/activate-invite
const { data, error } = await authClient.activateInvite({    role, // Required    email, // If email is present, the invite is private    tokenType,    redirectToSignUp,    redirectToSignIn,    maxUses,    expiresIn,    redirectToAfterUpgrade,    shareInviterName,    senderResponse,    senderResponseRedirect,});

Prop

Type

How is this guide?

Last updated on

On this page