discordjs / RPC

A simple RPC client for Discord
MIT License
474 stars 192 forks source link

Connection closed #127

Closed sinjs closed 3 years ago

sinjs commented 3 years ago

Following code

const RPC = require('discord-rpc');

const clientId = 'abc';
const clientSecret = 'def';
const scopes = ['rpc'];

const client = new RPC.Client({ "transport": "websocket" });

const startTimestamp = new Date()

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

    client.setActivity({
        details: "Test",
        state: "Test",
        startTimestamp,
        instance: false,
    });
});

client.login({ clientId, scopes, clientSecret });

Gives an error:

(node:10784) UnhandledPromiseRejectionWarning: Error: connection closed

I also tried changing the transport to IPC, I get the authorization screen on my discord client. When I click on authorize, this happens:

(node:15016) UnhandledPromiseRejectionWarning: Error: OAuth2 Error: invalid_request: Missing "redirect_uri" in request.

Can anyone help me?

sinjs commented 3 years ago

actually I am dumb, I thought that was for discord client lol