Loop
Loop
DIAdiscord.js - Imagine an app
Created by Loop on 9/15/2023 in #djs-questions
Using @discordjs/rest to make requests using Bearer access token
oh perfect, thank you! this works now 😄
const rest = new REST({
version: "10",
authPrefix: "Bearer",
}).setToken(accessToken);
const api = new API(rest);

let guilds= await api.users.getGuilds();
const rest = new REST({
version: "10",
authPrefix: "Bearer",
}).setToken(accessToken);
const api = new API(rest);

let guilds= await api.users.getGuilds();
6 replies
DIAdiscord.js - Imagine an app
Created by Loop on 9/15/2023 in #djs-questions
Using @discordjs/rest to make requests using Bearer access token
how would I go about making the requests use the users bearer token with that? I can't find a way to configure it to do that, this results in a 401 as well
const rest = new REST({
version: "10",
headers: {
Authorization: `Bearer ${accessToken}`,
},
}).setToken(accessToken);
const api = new API(rest);

let guilds = await api.users.getGuilds();
const rest = new REST({
version: "10",
headers: {
Authorization: `Bearer ${accessToken}`,
},
}).setToken(accessToken);
const api = new API(rest);

let guilds = await api.users.getGuilds();
6 replies
DIAdiscord.js - Imagine an app
Created by Loop on 9/15/2023 in #djs-questions
Using @discordjs/rest to make requests using Bearer access token
Node Version: v18.17.1
├─┬ @discordjs/[email protected]
│ └── [email protected]
├─┬ @discordjs/[email protected]
│ └── [email protected]
6 replies