Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SteamCommunity doesn't set cookies for SteamCommunity.request #332

Open
literobot opened this issue Jan 28, 2024 · 4 comments
Open

SteamCommunity doesn't set cookies for SteamCommunity.request #332

literobot opened this issue Jan 28, 2024 · 4 comments

Comments

@literobot
Copy link

literobot commented Jan 28, 2024

Hello,

I request my badges with:

const SteamUser = require('steam-user'),
Community = require('steamcommunity'),
MyUser = SteamUser(logInfo),
MyCommunity = new Community()
MyUser.on('webSession', (sessionID, cookies) => {
MyCommunity.setCookies(cookies)
})
SomeObject.on('request',function(){
MyCommunity.request("https://steamcommunity.com/my/badges/", function (err, response, body){
console.log(body) //there are my badges, when I request it for first time (after login)
})
})

But after couple of hours, when I request again, it returns a page there are no badges. I think something wrong with setCookie method, probably it sets cookies incorrectly, I don't know why.
Also I tried update cookies with:
MyCommunity.on('sessionExpired', (err) => { MyUser.webLogOn() })
or
setTimeout(()=>{ MyUser.webLogOn() }, coupleHours)
But got same the page with no badges.

[email protected]

@Revadike
Copy link
Contributor

Try calling webLogOn, and listen to MyUser.once('webSession') to set cookies, before making a steamcommunity request

@literobot
Copy link
Author

Try calling webLogOn, and listen to MyUser.once('webSession') to set cookies, before making a steamcommunity request

I do so but in this example I simplified the real code. As I said in first post it works for couple of hours, but after couple of hours it returns a page there are no badges

@Revadike
Copy link
Contributor

Are you sure SteamUser is stilled logged in? You can set auto-relog to true.
Btw, you should use the forums for help, not github issues

@literobot
Copy link
Author

Are you sure SteamUser is stilled logged in? You can set auto-relog to true. Btw, you should use the forums for help, not github issues

Yes, it's still logged in, 'auto-relog' is true by default. I guess it's a bug thats why my issue is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants