-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In reference to this snippet:
async (accessToken, refreshToken, profile, done) => {
const hacksuMembershipURL = `https://discord.com/api/v10/users/@me/guilds/632634799303032852/member`;
const data = await fetch(hacksuMembershipURL, { headers: {"Authorization": "Bearer " + accessToken } })
.then(res => res.json())
.catch(_ => null);
const roles: string[] = data?.roles ?? [];
if (roles.some(role => ROLES?.includes(role))) {
return done(null, {...profile, isLeader: true});
}
return done(null, false);
})This is a quick hack to setup a bunch of discord roles that can access and manage the staff site. At some point I had plans to make it so this was configurable from the staff page. It would be an nice feature to have. I can probably implement this myself at some point if nobody picks this up.
Maybe this even leads to a "better auth management" solution for this platform: role management for all users, session management, forced password updates, etc..
EDIT: I guess it also makes sense to completely move to just using Discord for auth, since it's easier to manage the roles there
Metadata
Metadata
Assignees
Labels
No labels