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

How do I send a request for the ‘log out from all devices’ button? #10

Open
VadikAladik opened this issue Dec 24, 2024 · 9 comments

Comments

@VadikAladik
Copy link

How do I send a request for the ‘log out from all devices’ button?

@Revadike
Copy link
Owner

await fetch("https://store.steampowered.com/twofactor/manage_action", {
    "credentials": "include",
    "referrer": "https://store.steampowered.com/twofactor/manage",
    "body": "action=deauthorize&sessionid=" + YOUR_BROWSER_SESSIONID,
    "method": "POST",
    "mode": "cors"
});

If this helped you in any way, please consider contributing to the wiki. It can be about this, or something else.
Happy Holidays!

@VadikAladik
Copy link
Author

Bro, I've been learning python for two months. Help please, I tried to make this command through queries but it doesn't work (after authorisation I see my login in devices), however I don't get kicked out.

`from steampy.client import SteamClient
import requests

API_KEY = 'my api'
USERNAME = 'login'
PASSWORD = 'pass'
SHARED_SECRET = 'name_of_maf😁.maFile'

def main():
client = SteamClient(API_KEY)
client.login(USERNAME, PASSWORD, SHARED_SECRET)

# Получаем все куки из внутренней сессии
cookies_dict = client._session.cookies.get_dict()

# Извлекаем sessionid
sessionid = cookies_dict.get('sessionid')
print("sessionid:", sessionid)


url = "https://store.steampowered.com/twofactor/manage_action"
headers = {
    "Referer": "https://store.steampowered.com/twofactor/manage"
}
data = {
    "action": "deauthorize",
    "sessionid": sessionid
}

response = requests.post(url, headers=headers, data=data)

if response.status_code == 200:
    print("Деавторизация успешна")
else:
    print(f"Ошибка: {response.status_code}")

if name == 'main':
main()`

@VadikAladik
Copy link
Author

Requests are really really hard 😥

@Revadike
Copy link
Owner

You need to be logged in the steam web

@VadikAladik
Copy link
Author

VadikAladik commented Dec 25, 2024

You need to be logged in the steam web

I realise this and I do successfully log in via ‘steampy’, I also get the sessionid via it, however my request does not kick out of the session

image

@Revadike
Copy link
Owner

I think you may need to add Content-Type: application/x-www-form-urlencoded header. My bad for removing the headers.

@VadikAladik
Copy link
Author

application/x-www-form-urlencoded

it didn't work 😥

@VadikAladik
Copy link
Author

I think you may need to add Content-Type: application/x-www-form-urlencoded header. My bad for removing the headers.

Maybe you know some other way? This is very important to me 😥

@Revadike
Copy link
Owner

Revadike commented Dec 29, 2024

I think you may need to add Content-Type: application/x-www-form-urlencoded header. My bad for removing the headers.

Maybe you know some other way? This is very important to me 😥

All I can tell you the request for
image

is the following:

await fetch("https://store.steampowered.com/twofactor/manage_action", {
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "Accept-Language": "en-US,en;q=0.5",
        "Content-Type": "application/x-www-form-urlencoded",
        "Sec-GPC": "1",
        "Upgrade-Insecure-Requests": "1",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "same-origin",
        "Sec-Fetch-User": "?1",
        "Priority": "u=0, i",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache"
    },
    "referrer": "https://store.steampowered.com/twofactor/manage",
    "body": "action=deauthorize&sessionid=xxxx",
    "method": "POST",
    "mode": "cors"
});

I can't help you more than that

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