Skip to content

Invitations

Invitations are the default way to add people into an existing organization in NuxtBase.

This flow is not just an email helper. It connects:

  • the members page
  • Better Auth invitation APIs
  • invitation emails
  • the /auth/accept-invitation route
  • active organization switching after acceptance

Invitations are restricted to organization managers:

  • owner
  • admin

Regular members do not get invitation controls.

On the members page, a manager opens the invite modal and submits:

  • email
  • role (member or admin)

The backend route then calls auth.api.createInvitation() for the target organization.

The invitation email uses a frontend acceptance URL built like this:

/auth/accept-invitation?id={invitationId}

That matters because the invitation flow is completed in the app UI, not in a raw provider callback page.

The members page also shows pending invitations and allows managers to:

  • resend an invite
  • cancel an invite

Both actions are implemented as real backend routes and also write audit logs.

The shipped acceptance flow is:

  1. invited user opens /auth/accept-invitation?id=...
  2. if the user is not signed in, they are sent to login with a redirect back to the invitation URL
  3. once authenticated, the app accepts the invitation through the auth client
  4. the accepted organization is set as the active organization
  5. the page enters a success state and offers a primary action to continue into the members area

That matters because acceptance is not just “mark invite accepted”. It also updates the current workspace context before the user continues.

The invitation page handles several states explicitly:

  • missing invitation ID
  • not signed in yet
  • ready to accept
  • processing
  • accepted
  • failed

This makes the flow easier to support and safer to customize.

Current invitation validation allows only:

  • member
  • admin

The template does not use invitation-based owner assignment in the normal dashboard flow.

  1. invite a member
  2. confirm the email is sent
  3. accept the invitation from a separate account
  4. verify the active organization switches
  5. resend a pending invitation
  6. cancel a pending invitation