The steamGuard event is emitted when Steam requests an authentication code (via email or app).
Important for 2FA users:
If you are using Two-Factor Authentication (TOTP), you must check the lastCodeWrong argument. If lastCodeWrong is true, the previous code provided was incorrect or already used. You must wait 30 seconds before providing a new code to allow the TOTP algorithm to generate a new one. Failing to wait can result in a login loop and a temporary IP ban.
If no listener is bound to this event, steam-user will attempt to prompt the user for a code via stdin.
user.on('steamGuard', function(domain, callback) {
console.log("Steam Guard code needed from email ending in " + domain);
var code = getCodeSomehow();
callback(code);
});