discordjs / RPC

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

No matter what scopes are chosen discord only authenticates with 2 #55

Closed CoreParadox closed 5 years ago

CoreParadox commented 5 years ago

here is my login line, I'm using IPC transfer protocol. client.login({clientId: creds.clientId, clientSecret: creds.clientSecret, scopes:["rpc.api", "rpc", "rpc.notifications.read"]});

Maybe I'm misunderstanding how RPC is allowed to be used, but I think that I should be able to subscribe to notification events with the "NOTIFICATION_CREATE" event.

However after authenticating with discord image

The dev console spits out this update (Sensitive data removed obviously): cmd: "AUTHENTICATE" data: expires: "2019-01-22T16:29:25.258000+00:00" scopes: Array(2) 0: "rpc" 1: "identify" length: 2

Additionally the notification_create event never receives any updates (it's registered in the "ready" event listener).

Thanks!

devsnek commented 5 years ago

@CoreParadox do you own the application

CoreParadox commented 5 years ago

@devsnek Yeah, I have it registered on the developer portal under the same account that I'm using with discord

CoreParadox commented 5 years ago

Here's some sample code for what I was trying (with tokens removed)

var RPC = require("discord-rpc")
const client = new RPC.Client({ transport: 'ipc' });
const creds = { clientId: '', clientSecret: '' }
RPC.register(creds.clientId);
client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
    client.on("NOTIFICATION_CREATE", (data) =>{
        console.log("notif recieved");
        console.log(data);
    })
});

client.login({clientId: creds.clientId, clientSecret: creds.clientSecret, scopes:["rpc.api", "rpc", "rpc.notifications.read"]}).catch(console.log);
CoreParadox commented 5 years ago

I changed client.on("NOTIFICATION_CREATE", ... to client.subscribe("NOTIFICATION_CREATE", ... and I get this

cmd: "SUBSCRIBE"
data: {code: 4006, message: "Not authenticated or invalid scope"}
evt: "ERROR"