RafGDev

steamcommunity mobile confirmations

Apr 14th, 2016
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var steamcommunity = require("steamcommunity");
  2. var community = new steamcommunity();
  3.  
  4. var SteamTotp = require("steam-totp");
  5.  
  6. community.login({
  7.   "accountName":"{ACCOUNTNAME}",
  8.   "password":"{ACCOUNTPASSWORD}",
  9.   "twoFactorCode": SteamTotp.generateAuthCode("{ACCOUNTTWOFACTORCODE}")
  10. },(loginError, sessionID, cookies, steamguard) => {
  11.   if (loginError)  {
  12.     console.log(loginError);
  13.   }
  14.   else {
  15.     community.loggedIn((communityError, loggedIn) => {
  16.       if (communityError)  {
  17.         console.log("err2 was: " + communityError);
  18.       }
  19.       else {
  20.                 if (loggedIn)  {
  21.                     SteamTotp.getTimeOffset((err, offset, latency) =>  {
  22.                         if (err)  {
  23.                             console.log("err is: " + err);
  24.                         }
  25.                         else {
  26.                             var unixTime = SteamTotp.time(offset);
  27.                             var confirmationKey = SteamTotp.getConfirmationKey("{IDENTITYSECRET}", unixTime, "conf");
  28.                            
  29.                             community.getConfirmations(unixTime, confirmationKey, (err, confirmations) =>  {
  30.                                 if (err)  {
  31.                                     console.log("There was an error");
  32.                                     console.log(err)
  33.                                 }
  34.                                 else {
  35.                                     console.log(confirmations);
  36.                                 }
  37.                             });    
  38.                         }
  39.                     });
  40.                            
  41.                                 }
  42.                 else {
  43.                     console.log("You have not logged in");
  44.                 }
  45.             }
  46.     });
  47.   }
  48. });
Advertisement
Add Comment
Please, Sign In to add comment