smogon / pokemon-showdown-loginserver

MIT License
4 stars 26 forks source link

Two-factor authentication support #4

Closed tmagicturtle closed 1 year ago

tmagicturtle commented 2 years ago

Requires 1 dependency: "2fa-util". It has two deps of its own, otplib and qrcode, and is a single MIT licensed file, so we can use it directly instead of requiring as a node package. But it carries much of the work - it securely generates TOTP secrets, handles verifying TOTP tokens, and generates QR codes for the end-user to scan in their 2FA app.

Functioning demonstration video: https://www.youtube.com/watch?v=znuIBtmO-R8

Lastly, I was unable to get my client/server to work nicely with cookies. In developing this, I had to cheat by forcing the user to be logged in as fart. The code as applied takes the login procedure from other methods, so it SHOULD work, but due to the aforementioned complications, it is untested.