🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

[help] can't start/connect Locked

A topic by THD created 1 year ago Views: 397 Replies: 13
This topic was locked by Elisée 1 year ago
Viewing posts 1 to 14

Hey,

I just downloaded superpowers-0.18.1-win-x64.zip on Windows 7.
I run it and double-click on My Server.
Whatever I type in the username box I click Log In and it flashes a Connecting... screen for a split second and it returns to the Log In screen.

Nothing else happens. No errors. Nothing. Whats wrong? :(

That's very weird, it likes the cookie with your username can't be set somehow? Can you try leaving the launcher running and connecting through your Web browser at http://localhost:4237/ instead?

Same thing on Chrome and Firefox. It just flashes the Connecting... screen and returns to Log In :(

(Edited 1 time)

OK, I'm a bit stumped. Can you try defining a password in your server settings and restarting it?

It's the same. It doesn't even say I need a password, just flashes the connecting screen and back. I cant really provide more info. Dev console in chrome shows nothing. If you release something with more debug info we could try to resolve this?

Can you check if there's a cookie named "supServerAuth" in the Resources tab of the Chrome devtools?

Also, do you happen to have an antivirus/firewall that might be clearing cookies automatically or doing anything weird with them?

(Edited 2 times)

Yes it's there http://prntscr.com/9paw85


No antivirus or anything.

OK, let's dig deeper :D

1. Open Superpowers/resources/app/server/index.js and look for:

function redirectIfNoAuth(req, res, next) {
    if (req.cookies["supServerAuth"] == null) {
        res.redirect("/login?redirect=" + encodeURIComponent(req.originalUrl));
        return;
    }
    next();
}

2. Now, remove the 4 first lines in the function, so that it looks like this:

function redirectIfNoAuth(req, res, next) {
    next();
}

This will remove the server-side cookie check. Restart your server. Does it work?

3. Now, try logging the cookies being sent to the server:

function redirectIfNoAuth(req, res, next) {
    console.log(req.cookies);
    if (req.cookies["supServerAuth"] == null) {
        res.redirect("/login?redirect=" + encodeURIComponent(req.originalUrl));
        return;
    }
    next();
}

Are the cookies properly logged in the server console?

4. Now open Superpowers/resources/app/public/SupClient.js and look for:

var supServerAuth = cookies.get("supServerAuth");
var socket = io.connect(window.location.protocol + "//" + window.location.host + "/" + namespace, { transports: ["websocket"], reconnection: options.reconnection, query: { supServerAuth: supServerAuth } });

Insert a console.log call between the two lines:

var supServerAuth = cookies.get("supServerAuth");
console.log(supServerAuth);
var socket = io.connect(window.location.protocol + "//" + window.location.host + "/" + namespace, { transports: ["websocket"], reconnection: options.reconnection, query: { supServerAuth: supServerAuth } });

Open the devtools (F12). What does the Console tab say?

That should help a bit, I got other ideas if needed.

It's the same with those lines removed.

The cookie is fine, it says
{"serverPassword":"qwerty","username":"mm"}

on both ends. It must be something after the authentication.

here's the next() function in redirectIfNoAuth, if that helps:

if (err && err === 'route') {

return done();

}

var layer = stack[idx++];

if (!layer) {

return done(err);

}

if (layer.method && layer.method !== method) {

return next(err);

}

if (err) {

layer.handle_error(err, req, res, next);

} else {

layer.handle_request(req, res, next);

}

}

OK, we're narrowing it down. Open public/hub/index.js and look for the following lines:

function onConnectionError() {
    window.location.replace("/login");
}

Replace them with:

function onConnectionError(err) {
console.log(err);
}

And let's see what gets logged in the console.

It says:
index.js:89 invalidUsername

cookie is {"serverPassword":"qwerty","username":"mm"}

the username is arbitrary right?

Oh my god, your username must be 3 characters long at least... So it was invalid indeed.

We improved the feedback on this in today's new version (v0.19.0). And it was really necessary...

(Edited 1 time)

Oh wow, can't believe that was it lol. Sorry for wasting your time with the lack of error reporting in the UI. At least with 0.19 the error will be displayed clearly.

(+1)

LOL

yes that fixed it :)