Skip to content

Use Better Auth invitation delivery and native resend - #74

Merged
tnkuehne merged 2 commits into
mainfrom
fix/native-invitation-delivery
Oct 22, 2026
Merged

tnkuehne merged 2 commits into
mainfrom
fix/native-invitation-delivery

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

After invitation email delivery failed, inviting the same address again returned “already invited” with no supported resend action. Route ordinary membership invitation emails through Better Auth's sendInvitationEmail hook and expose its native resend option through the shared API, widefleet invitations invite EMAIL --resend, and a pending-invitation button.

Remove the post-invitation organization lookup and separately orchestrated email send. Better Auth owns creation, role checks, duplicate handling, renewal and sending. Resending an existing pending invitation retains its ID and role and renews the native 48-hour expiry. The operator's existing first-owner provisioning remains separate because it runs before an organization has members; both paths share the same mail formatter and transport.

The installed Better Auth version logs delivery failures and returns the saved invitation successfully. Keep that native behavior: the UI confirms that the invitation was saved, rather than claiming delivery succeeded. A failed delivery remains visible as a pending invitation and can be resent. No new database state, retry queue, dependency or library patch is added.

Native permission detail: an admin can resend an already-issued owner invitation by submitting a non-owner role; Better Auth retains the original owner grant. The admin still cannot create a new owner invitation. The integration test records this behavior rather than adding a custom restriction. The existing UI still hides owner-invitation actions from admins.

Validation:

  • pnpm check passes (workspace types, formatting, type-aware lint).
  • All 7 organization-login integration tests pass with the real CLI enabled. They cover delivery failure, successful resend, same ID and role, renewed expiry, no duplicate invitation, and rejected foreign-organization requests.
  • The onboarding browser test passes with failed delivery followed by resend for two organizations.
  • CLI build and cargo clippy -p platform-cli --all-targets -- -D warnings pass.

Documentation is maintained separately in #58 and remains unreleased.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no outstanding findings.

Summary

Routes invitation emails through Better Auth and adds native resend support to the API, CLI, and members page.

  • Better Auth sends ordinary organization invitation emails.
  • Pending organization invitations can be resent from the page and CLI.

Reviews (2) · Last reviewed commit: "Cover native resend permissions for exis..." · Reviewed by Greptile

@tnkuehne
tnkuehne added this pull request to stack #75 October 22, 2026 14:39
@tnkuehne
tnkuehne force-pushed the fix/native-invitation-delivery branch from 3e20f79 to 0cbea68 Compare October 22, 2026 14:41
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 0cbea68 Oct 22 2026, 02:42 PM

@tnkuehne
tnkuehne merged commit b8ddc78 into main Oct 22, 2026
16 of 17 checks passed
@tnkuehne
tnkuehne deleted the fix/native-invitation-delivery branch October 22, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant