Jump to content
McKay Development

Strange behavior of setCookies


lll

Recommended Posts

This topic https://dev.doctormckay.com/topic/365-cookies/#user-cookieusage says

Quote

calling setCookies on the TradeOfferManager will also call setCookies on the SteamCommunity, and therefore you need not call setCookies on SteamCommunity (although it doesn't hurt anything, either)

after authorization (webSession emit) i call my method to set cookie:

    setCookies(cookies) {
        return util
            .promisify(this.manager.setCookies)
            .call(this.manager, cookies);
    }

and then it sometimes happens when I try to call this.community.acceptConfirmationForObject:

D:\projects\terminal\node_modules\steamcommunity\components\confirmations.js:247
                throw new Error("Must be logged in before trying to do anything with confirmations");
                ^

Error: Must be logged in before trying to do anything with confirmations
    at request (D:\projects\terminal\node_modules\steamcommunity\components\confirmations.js:247:9)
    at SteamCommunity.getConfirmations (D:\projects\terminal\node_modules\steamcommunity\components\confirmations.js:17:2)
    at doConfirmation (D:\projects\terminal\node_modules\steamcommunity\components\confirmations.js:182:8)
    at D:\projects\terminal\node_modules\steamcommunity\components\confirmations.js:170:4
    at IncomingMessage.<anonymous> (D:\projects\terminal\node_modules\steamcommunity\node_modules\steam-totp\index.js:129:4)

 

1. How can I handle such error messages?

2. This is fixed if you add cookies to the community yourself, I.E. 

    setCookies(cookies) {
        this.community.setCookies(cookies);

        return util
            .promisify(this.manager.setCookies)
            .call(this.manager, cookies);
    }

but it contradicts that topic

Link to comment
Share on other sites

    constructor(details, db) {
        this.user = new SteamUser({
            machineIdType: 3
        });
        this.community = new SteamCommunity({
            request: this.request,
            userAgent
        });
        this.manager = new TradeOfferManager({
            steam: this.user,
            community: this.community,
            domain: process.env.logInDomain,
            language: 'en'
        });
        this._jar = this.community._jar;
        this._logInDetails = details;

        this.user.on('error', () => {
            this.logOut();
        });
        this.user.on('loginKey', loginKey =>
            db.update('Bots', { accountName: details.accountName }, { loginKey }));

        this.community.on('sessionExpired', () =>
            this.completeLogin(false));
    }

"steam-tradeoffer-manager": "^2.10.2"

"steam-user": "^4.16.2"

 "steamcommunity": "^3.41.4"

Link to comment
Share on other sites

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...