Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem setting this up with Electron #5

Closed
Armaldio opened this issue Nov 10, 2017 · 9 comments
Closed

Problem setting this up with Electron #5

Armaldio opened this issue Nov 10, 2017 · 9 comments

Comments

@Armaldio
Copy link

I'm trying to add rich presence to an electron app.

I've tried the default code:
After accepting discord auth, it redirects to my redirect Url, but not access token, I got this instead : http://localhost:4242/oauth/redirect#error=invalid_scope
So I tried removing scopes. I just kept rpc.api scope.
This time, I get the token.

But when I try to

client.login(config.clientId, {
        accessToken: token,
        scopes     : config.scopes
});

all I get is

https://i.imgur.com/sgqLe8I.png

Could you help on that ?
Thanks

@devsnek
Copy link
Member

devsnek commented Nov 10, 2017

you can't use WebSocket for rich presence unless you're whitelisted, you have to use IPC, and no auth is required to use it.

@devsnek devsnek closed this as completed Nov 10, 2017
@Armaldio
Copy link
Author

Armaldio commented Nov 11, 2017

If I use the Rich Presence example on the readme using IPC I get:
Cannot read property 'accessToken' of undefined

@Armaldio
Copy link
Author

Ok, updated from beta1 to beta2 and now it show Ready, setting rich presence but no rich presence
It still show the old format

@Armaldio
Copy link
Author

I've already done that.
As i've told you It still show the old format

I can also see that the event SET_ACTIVITY is correctly sent to discord with - from what I can understand - correct datas

@Armaldio
Copy link
Author

Is there an error event I can listen to ?

@Armaldio
Copy link
Author

I got it working now.
It's working with nodejs and electron

For anyone in the same case as me, you must put the code inside the main.js file and not the renderer.js file.
I still don't know why, I will try to find more infos.
You can still communicate between the main and the renderer process using IPC or any other methods

@devsnek
Copy link
Member

devsnek commented Nov 11, 2017

it has to go in main because its a separate process from renderer. Discord will think that your process has no window and therefore won't think its a game if its in the renderer

@Armaldio
Copy link
Author

Ok, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants