Inviting a teammate with nextAuth

Hi guys, in [...nextAuth], the email provider is working nicely:
EmailProvider({
sendVerificationRequest(params: SendVerificationRequestParams) {
const { identifier: email, url, expires } = params;
const newParams = { ...mailjetParams, email, url };
newParams.email = params.identifier;
sendEmailWithMailjet(newParams as SendWithMailjetProps);
},
}),
EmailProvider({
sendVerificationRequest(params: SendVerificationRequestParams) {
const { identifier: email, url, expires } = params;
const newParams = { ...mailjetParams, email, url };
newParams.email = params.identifier;
sendEmailWithMailjet(newParams as SendWithMailjetProps);
},
}),
Now i want to add invite team members functionality. How can I trigger this from the server side?
23 Replies
fotoflo
fotofloOP2y ago
can i just grab import EmailProvider from "next-auth/providers/email";. anywhere in teh application? ... lets see what happens didnt work
arete
arete2y ago
do you want to make a whitelist?
theo (t3.gg)
theo (t3.gg)2y ago
"invite a teammate" is a complex enough concept that you'd be rolling it yourself Do you want teams functionality? Like teams with shared permission sets and such?
theo (t3.gg)
theo (t3.gg)2y ago
If clerk has this built in I'd just use that tbh https://clerk.dev/?ref=theo
Clerk
Clerk | Authentication and User Management
The easiest way to add authentication and user management to your application. Purpose-built for React, Next.js, Remix, and “The Modern Web”.
fotoflo
fotofloOP2y ago
itneresting thanks i created teams and roles already i just wanted to trigger sendAuthentioRequest to send an email that has a token wasnt sure if thats possible, will checkout clerk thank you @theo @Devastated no i dont think thats what im after
theo (t3.gg)
theo (t3.gg)2y ago
You can't send an authentication request for a user who doesn't exist
fotoflo
fotofloOP2y ago
i actually create the user first that's done
theo (t3.gg)
theo (t3.gg)2y ago
...I don't recommend creating users without the user authing Basically asking for a split brain problem
fotoflo
fotofloOP2y ago
but not the accounts accounts Account[] sessions Session[]
theo (t3.gg)
theo (t3.gg)2y ago
I've shared all I have, I'm out. Pls dont @ me
fotoflo
fotofloOP2y ago
what is splitbrain problem?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
fotoflo
fotofloOP2y ago
thanks. How do i pass a token across login? i re-archtected this... sending them to the login page with a token,
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
fotoflo
fotofloOP2y ago
in most flows ive seen the user accepts the invite by clicking a fully formed link with a token in an email that takes them to login they login, and the token is passed with the oauth or email login
barry
barry2y ago
Yeah seems like a good approach
fotoflo
fotofloOP2y ago
but how do you pass the invite token across the next-auth boundry? cc @barry @Nedi ? i got the invite token and i figured out how to pass it through google auth! i think it looks like i send them through a page like nedi suggested. maybe just a redirect
Diogo
Diogo2y ago
Take a look at dub.sh it's open-source and ut has team functionality
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
fotoflo
fotofloOP2y ago
i did that, its working... 🙂 thank you! i think im almost there. would have been way beter to just hijack the emailProvider functionality
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
fotoflo
fotofloOP2y ago
its kind of irrelevant at this point... this is how it does work
Want results from more Discord servers?
Add your server