NextAuth Discord Getting Guilds
I've been trying to do this for hours now, how do I fetch the users guilds via NextAuth ? I then want to store the guilds within the guilds within the token. Spoon Feeding would be amazing, I have depression because of this.
20 Replies
that is my [...nextauth].js
That is my UseSession.ts (hook)
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
can't you just use this
I’m not sure how or where I’d query it
GitHub
Getting Discord Guilds · Discussion #3774 · nextauthjs/next-auth
Question 💬 Hello, I've been reading the docs and trying stuff out for sometime now, with callbacks, changing scopes, playing with prisma and so one. Despite all of this, I just can'...
this was the second result on google?
maybe that slight yidfferent in scopes might help?
otherwise i think you can do it on the clientside?
I’ve tried this and several variations
For hours
id try and write a piece of code that gets this for your specific user
and then see if you can generalise it
I have the code to get the user
That works fine
I use the nextAuth profile for that
I have but it does the fetch via nextAuth Profile *
sorry mean get the guild for your specific user?
I’m not sure what you mean sorry
I’m trying to map all of the guilds the user is in
yeah so start simple, are you able to do it for your user
No
Fetching User or guilds would be the same function with a slightly different API ?
thats what it should be yeah
I did it via nextAuth profile lol
Wild idea: how about you store the guilds of each user in the database, add a relation between guilds and users and you can directly query your db for the guilds of a user. Would that work for you?
This way you would not need to fetch the guilds from discord for auth
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I think in most situations that would work, however I need to map out:
- All guilds user is in
- All guilds user is in with bot
I’m trying to make a page which displays the different guilds you can configure (or add my discord bot too)
How about you move this responsibilty to a new endpoint which is regularely invoked, either by the client when a user loads the page or a cron job
I mean probably, I just want to know how you can create different ‘profiles’ and how to configure the endpoints if there is a way