After developing a site using NextJs, I successfully integrated Discord login functionality and was able to retrieve the user's guilds in the oauth file.
Now, I am looking to send this list of guilds (in JSON format) to my dashboard page.
In the oauth.tsx file:
export default async (req: NextApiRequest, res: NextApiResponse) => {
...
const guildsuser = await fetch("http://discord.com/api/users/@me/guilds", {
headers: { Authorization: `${token_type} ${access_token}` },
});
const guilds = guildsuser.json();
}
The guilds
constant contains the data that I want to pass to the dashboard page for display.