Inviting a teammate with nextAuth
Hi guys,
in [...nextAuth], the email provider is working nicely:
Now i want to add invite team members functionality. How can I trigger this from the server side?
23 Replies
can i just grab
import EmailProvider from "next-auth/providers/email";
. anywhere in teh application?
... lets see what happens
didnt workdo you want to make a whitelist?
"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?
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”.
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
You can't send an authentication request for a user who doesn't exist
i actually create the user first
that's done
...I don't recommend creating users without the user authing
Basically asking for a split brain problem
but not the accounts
accounts Account[]
sessions Session[]
I've shared all I have, I'm out. Pls dont @ me
what is splitbrain problem?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
thanks. How do i pass a token across login?
i re-archtected this... sending them to the login page with a token,
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
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
Yeah seems like a good approach
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
Take a look at dub.sh it's open-source and ut has team functionality
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
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•2y ago
Message Not Public
Sign In & Join Server To View
its kind of irrelevant at this point... this is how it does work