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

Can't login (The provided session_token_code is invalid) #174

Closed paul-sama closed 6 months ago

paul-sama commented 6 months ago

get_session_token error

https://accounts.nintendo.com/connect/1.0.0/api/session_token

return {"error_description":"The provided session_token_code is invalid","error":"invalid_request"}

frozenpandaman commented 6 months ago

Hmm………

I'm able to generate a new gtoken and bulletToken from my previously-existing config.txt/session_token:

$ ./s3s.py
s3s v0.6.2
Checking if there are previously-unuploaded battles...
Blank token(s).          
Attempting to generate new gtoken and bulletToken...
Wrote tokens for eli to config.txt.

But I can't seem to create a new one:

$ ./s3s.py
s3s v0.6.2
stat.ink API key: skip
Default locale is en-US. Press Enter to accept, or enter your own (see readme for list).

Checking if there are previously-unuploaded battles...
Blank token(s).          
Please log in to your Nintendo Account to obtain your session_token.

Make sure you have read the "Token generation" section of the readme before proceeding. To manually input your tokens instead, enter "skip" at the prompt below.

Navigate to this URL in your browser:
-snip-
Log in, right click the "Select this account" button, copy the link address, and paste it below:
-snip-

The URL has expired. Please log out and back into your Nintendo Account and try again.

Something must've changed on Nintendo's end. Will look into it…

Cypas commented 6 months ago

I too, can not log in

frozenpandaman commented 6 months ago

OK, I have no clue why the regex (suddenly??? why now???) started capturing the wrong session_token_code value from the URL, thus leading to this error… honestly, so confused why this issue popped up now, never before, unless some default behavior in re parsing changed or whatnot… truly bizarre unless I'm just totally overlooking something… Anyway, it was a 1 character fix, lol. Thanks for the heads up!

Cypas commented 6 months ago

Thank you

frozenpandaman commented 6 months ago

OK, making more sense now... looks like Nintendo changed the URL structure on the connect/1.0.0/authorize page, specifically the ordering of the parameters. This is the URL provided when you right-click "Select this account" and paste it into s3s:

Old: npf71b963c1b7b6d119://auth#state=blah&session_token_code=jsonwebtoken&session_state=blahblah

New: npf71b963c1b7b6d119://auth#session_token_code=jsonwebtoken&state=blah&session_state=blahblah

Which broke our regex parsing of this string 😅