frozenpandaman / s3s

Successor to splatnet2statink. Takes battle data from the SplatNet 3 app and uploads it to stat.ink!
https://github.com/frozenpandaman/s3s/wiki
GNU General Public License v3.0
394 stars 72 forks source link

Accessing browser SplatNet 3 no longer works #140

Closed Ondrashek06 closed 1 year ago

Ondrashek06 commented 1 year ago

The guide in the readme no longer works to access SplatNet 3, I get a connection error even with the correct gToken set in the cookie. api.lp1.av5ja.srv.nintendo.net shows the GUI for a split second before showing the error and returning HTTP 400.

samuelthomas2774 commented 1 year ago

Since 4.0.0-b8c1e0fc (21/08/2023) the home page always attempts to get a second web service token using a custom JavaScript API to check if Tournament Manager is available/check for notifications, which fails in a normal browser.

It's still possible to use other parts of SplatNet 3 in a browser without the app's JS APIs in the same way by just avoiding the home page (and room creation, which uses the same API as tournaments and never worked in a normal browser), e.g. if you go directly to https://api.lp1.av5ja.srv.nintendo.net/schedule or any other page.

Otherwise you need to use an app/browser that implements the app's JavaScript APIs, or you can run something like this before SplatNet 3's JS runs using an extension/breakpoint (not tested; this also means you don't need to set a cookie):

(() => {
    // "web service token" and "game web token" is the same thing
    const token = 'your web service token';

    window.requestGameWebToken = function () {
        Promise.resolve().then(() => window.onGameWebTokenReceive?.call(null, token));
    };
})();

(Copied this mostly from stuff I wrote on Discord.)

frozenpandaman commented 1 year ago

I became aware of this a few days ago with the SplatNet update but have been super busy (applying to jobs!) – so I haven't gotten around to updating to readme yet or looking into it myself. Thanks for the info, @samuelthomas2774! Will be addressed soon.

frozenpandaman commented 1 year ago

There's a new guide up at https://github.com/frozenpandaman/s3s/wiki/in%E2%80%90browser-splatnet-3 for accessing SplatNet 3. I wrote a userscript to prompt users for their gtoken & then run @samuelthomas2774's code above when the homepage is loaded. I've updated the readme as well.

Thanks, @Ondrashek06 – and you too, Sam, again!