smogon / pokemon-showdown-loginserver

MIT License
4 stars 26 forks source link

Fix code sample for getting a token #18

Closed Async10 closed 1 year ago

Async10 commented 1 year ago

The code sample given for getting a token had multiple problems. The call to checkIfUpdated was incorrect and the code didn't take into account that a DOMException is thrown when trying to read popup.location.href before the redirect happened. Apart from that I added url encoding of the query parameters and some simple sanity checks on the received token and assertion values in order to make the sample a bit more robust. I hope this helps.