basic setup with djs rpc

hey. i'm new to typescript (not programming) so bear with me i'm trying to get setup with discord-rpc but i'm running into this error:
Error: OAuth2 Authorization Error: Unknown Error
at RPCClient._onRpcMessage (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\client.js:178:19)
at IPCTransport.emit (node:events:519:28)
at C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:138:18
at decode (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:92:5)
at Socket.<anonymous> (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:120:7)
at Socket.emit (node:events:519:28)
at emitReadable_ (node:internal/streams/readable:832:12)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {
code: 5000,
data: { code: 5000, message: 'OAuth2 Authorization Error: Unknown Error' }
}
Error: OAuth2 Authorization Error: Unknown Error
at RPCClient._onRpcMessage (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\client.js:178:19)
at IPCTransport.emit (node:events:519:28)
at C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:138:18
at decode (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:92:5)
at Socket.<anonymous> (C:\Users\james.griggs\Desktop\i hate programming pt 2\typescript projects\testing-purposes\node_modules\discord-rpc\src\transports\ipc.js:120:7)
at Socket.emit (node:events:519:28)
at emitReadable_ (node:internal/streams/readable:832:12)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {
code: 5000,
data: { code: 5000, message: 'OAuth2 Authorization Error: Unknown Error' }
}
node: v20.17.0 - i don't know if i have djs installed or not (i assumed i didnt need the whole package since i'm only doing RPC stuff)
2 Replies
d.js toolkit
d.js toolkit4w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
slowly losing it
slowly losing itOP4w ago
oh yeah code
import { Client } from 'discord-rpc';
import { CLIENT_ID, CLIENT_SECRET } from './vars';

const client = new Client({
transport: 'ips'
});

client.on('ready', () => {
console.log(`Logged in as ${client.application!.name}`);
console.log(`Authed for user ${client.user!.username!}`);
});

client.login({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
scopes: ['rpc', 'rpc.api']
});
import { Client } from 'discord-rpc';
import { CLIENT_ID, CLIENT_SECRET } from './vars';

const client = new Client({
transport: 'ips'
});

client.on('ready', () => {
console.log(`Logged in as ${client.application!.name}`);
console.log(`Authed for user ${client.user!.username!}`);
});

client.login({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
scopes: ['rpc', 'rpc.api']
});
i'm following this browser example, for reference :wait: i fixed it dw

Did you find this page helpful?