Jonas Dautel
Jonas Dautel
BABetter Auth
Created by DarkZelus on 4/16/2025 in #help
Invitation email
no worries 🙂 i have been there xD
6 replies
BABetter Auth
Created by DarkZelus on 4/16/2025 in #help
Invitation email
hey @DarkZelus , check out this part of the docs : https://www.better-auth.com/docs/plugins/organization#setup-invitation-email Here is the example from there
import { betterAuth } from "better-auth"
import { organization } from "better-auth/plugins"
import { sendOrganizationInvitation } from "./email"
export const auth = betterAuth({
plugins: [
organization({
async sendInvitationEmail(data) {
const inviteLink = `https://example.com/accept-invitation/${data.id}`
sendOrganizationInvitation({
email: data.email,
invitedByUsername: data.inviter.user.name,
invitedByEmail: data.inviter.user.email,
teamName: data.organization.name,
inviteLink
})
},
}),
],
});
import { betterAuth } from "better-auth"
import { organization } from "better-auth/plugins"
import { sendOrganizationInvitation } from "./email"
export const auth = betterAuth({
plugins: [
organization({
async sendInvitationEmail(data) {
const inviteLink = `https://example.com/accept-invitation/${data.id}`
sendOrganizationInvitation({
email: data.email,
invitedByUsername: data.inviter.user.name,
invitedByEmail: data.inviter.user.email,
teamName: data.organization.name,
inviteLink
})
},
}),
],
});
where then sendOrganizationInvitation is a function you create to use a email provider of your choice
6 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
ah copy thanks. I will think trough how i want to do the onbaord flow then. currently i thought i woudl either display invites when a user logged in ot the option to create an org but seams that might not fit. thanks again !
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
thats a great idea thanks! i think i just need to find a way to keep the id in the url when i send the user to login first 🙂 thanks this really helped
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
yeah. I see that but does that mean the ivite id is the only thing normally checked right ? doesn't matter if the user actually has the email that the ivite was sent to.
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
thanks ! i was just trying to see how the flow normaly works.
31 replies
BABetter Auth
Created by Jonas Dautel on 2/16/2025 in #help
get Open Invites for user ?
does a person need to be logged in to accept the invite ?
31 replies