Discord multi-role authentication system
I want to create a multi role authentication system using Discord as an auth provider in my Next.JS app. Is it possible?
10 Replies
Like synced to discord's roles?
Either that or just have paid users, admins, reg users, moderators etc. I've tied things like this to firebase and supabase, but i've only done single role auth with Discord.
if tied to Discord's roles, i suppose I would need to tie in specific discord roles to particular users somehow.
If its tied to discord's roles, then they would have to be linked with like servers and people would have to be in servers, etc.
if you just want regular RBAC then your auth provider being discord has like almost no impact
Okay, so if i set up the auth in Discord then and. i saved all the information within something like supabase, i assume I would need a way to save a link between the two? if so would that come from an api response? Sorry for the line of questions. Most searching returned mult-factor authentication.
Link between the two for what
When I create a new user in Supabase or Firebase, the user is assigned a userId. When i simultaneously creaet a document for their information, I save the id from auth to the doc so that they're linked and I know that this user's info belongs to this perrson who is signed in. info including role="admin" for instance.
@Gold240sx go look through the api package of https://github.com/AnswerOverflow/AnswerOverflow/blob/main/packages/api/src/utils/permissions.ts
GitHub
AnswerOverflow/packages/api/src/utils/permissions.ts at main · Answ...
Indexing Discord Help Channel Questions into Google - AnswerOverflow/AnswerOverflow
That’s got all the implementation details you’re looking for
That looks perfect! Thank you both. I’ll take a good look.
Can also get discord role info (within the context of a server) pretty easy with discordjs
https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/understanding/roles.md
I had a project where I wanted the web app to show particular options if the user was an mod/admin of the discord server that was associated
GitHub
discordjs-bot-guide/understanding/roles.md at master · AnIdiotsGuid...
The basic new coder friendly "idiot's guide", Created by Hindsight#2020 and maintained by the community. - AnIdiotsGuide/discordjs-bot-guide