Jump to content
McKay Development

Recommended Posts

Posted

HI, i trying to write a bot manager for trading, i try to get my secrect id and shared code by using this code:

var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();

community.login({
  "accountName": "MyAccountName",
  "password": "MyPassword",
  "twoFactorCode": "6 char code that i receive from steam guard mobile"
}, function (err, sessionId, cookies, steamGuard, token) {
  if (err) {
    console.log(err);
  }
  else {
        community.loggedIn(function (err, result) {
      if (err) {
        console.log("loggedIn error: ", err);
      }
      else {
        community.enableTwoFactor(function (err, response) {
          if (err) {
            console.log("twoFactor Error: ", err);
          } else {
            console.log("response", response);
            community.finalizeTwoFactor(response.shared_secret, test, function(err, result){
              if("finalizeTwoFactor Error: ", err) {

               } else {
                 console.log("finalizeTwoFactor Success: ", result);
               }
             });
          }
        });
      }
    });
  }
});

I enabled my bot account with steam guard mobile, and verify the number, but when i try to start that code i get this error:

 

twoFactor Error:  { [Error: Error 29] eresult: 29 }

 

what did i miss here? i try to search in this forum and google but i can't find my answer.

 

Posted

Thanks, for you're reply, i resolve my problem, i revoke steam guard from my mobile first, then using the sample code for enabling 2fa from steamcommunity github, and that worked for me.

  • 9 years later...
Posted (edited)

@Dr. McKay I'm having the same error right now. 2FA isn't connected (only via email). How can I fix this?

 

My solution:
First, I enter my username/password.
A code is sent to my email.
I enter my username/password and the code again.

And I get this error: DuplicateRequest

 

Edited by Gospodinoff
Posted

The code is event-driven.

First, login() is called. Then, the "steam guard" code is entered, and the login() request is repeated.

 

Quote
async login(data: LoginSchema) {
        const options: {
            accountName: string,
            password: string,
            disableMobile: boolean,
            authCode?: string,
            twoFactorCode?: string
        } = {
            accountName: data.username,
            password: data.password,
            disableMobile: false,
        };

        if (data.username === '' || data.password === '') {
            this.logger.log('info', 'AuthManager:login Проверка введённых данных', {
                message: 'Вы не ввели логин и/или пароль!',
                data: options
            });

            this.mainWindow.webContents.send('accounts:auth:callback', {
                type: 'warning',
                message: 'Вы не ввели логин и/или пароль!',
                data: data,
                nextStep: null,
                nextEvent: null,
                redirect: {name: 'accounts-add'}
            });
            return;
        }

        if (data.code) {
            options.authCode = data.code;

            this.logger.log('info', 'AuthManager:login Второй вызов, по идеи, с кодом', {
                message: 'Подтверждаем SteamGuard код, высланный на почту',
                data: options,
            });
        }

        this.logger.log('info', 'AuthManager:login Итоговые данные для передачи в авторизацию', {
            data: options,
        });

        this.SteamCommunity.login(options, async (err: any, sessionID: string, cookies: string[]) => {
            if (err) {
                this.logger.log('info', 'AuthManager:login Выводим общую ошибку', {
                    message: err.message,
                });

                let message = '';
                switch (err.message) {
                    case 'RateLimitExceeded':
                        message = 'Ваша учётная запись попала в лимиты запросов. Повторите попытку позднее!';

                        this.logger.log('info', 'AuthManager:login Error: RateLimitExceeded', {
                            message: message,
                        });

                        this.mainWindow.webContents.send('accounts:auth:callback', {
                            type: 'warning',
                            message: message,
                            data: data,
                            nextStep: null,
                            nextEvent: null,
                            redirect: {name: 'index'}
                        });
                        break;

                    case 'SteamGuard':
                        message = `На вашу почту "**********${err.emaildomain}" отправлено письмо с кодом подтверждения. Введите его в поле.`;

                        this.logger.log('info', 'AuthManager:login Error: SteamGuard', {
                            message: message
                        });

                        this.mainWindow.webContents.send('accounts:auth:callback', {
                            type: 'success',
                            message: message,
                            data: data,
                            nextStep: 'steamguard',
                            nextEvent: 'accounts:auth:submit_code',
                        });
                    break;

                    case 'SteamGuardMobile':
                        message = `Введите код из мобильного аутентификатора.`;

                        this.logger.log('info', 'AuthManager:login Error: SteamGuardMobile', {
                            message: message,
                        });

                        this.mainWindow.webContents.send('accounts:auth:callback', {
                            type: 'success',
                            message: message,
                            data: data,
                            nextStep: 'steamguard_mobile',
                            nextEvent: 'accounts:auth:submit_code',
                        });
                        break;

                    case 'DuplicateRequest':
                        message = 'Steam Guard Mobile уже подключён или произошёл дубликат запросов на добавление Steam Guard Mobile.';

                        this.logger.log('info', 'AuthManager:login Error: DuplicateRequest', {
                            message: message,
                        });

                        this.mainWindow.webContents.send('accounts:auth:callback', {
                            type: 'warning',
                            message: message,
                            data: data,
                            nextStep: null,
                            nextEvent: null,
                            redirect: {name: 'index'}
                        });
                        break;

                    default:
                        message = err.message;

                        this.logger.log('info', 'AuthManager:login', {
                            message: message,
                        });

                        break;
                }
            } else {
                this.logger.log('info', 'AuthManager:login', {
                    message: 'Всё прошло успешно, начинаем установку 2fa',
                });

                console.log('sessionID', sessionID)

                this.AccountStorageManager.save(data.username, {
                    account: {
                        username: data.username,
                    },
                    cookies: cookies,
                });

                // Начинаем установку 2FA
                this.startTwoFactor(data);
            }
        });
    }

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...