InternalSteamWebAPI icon indicating copy to clipboard operation
InternalSteamWebAPI copied to clipboard

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

Open VadikAladik opened this issue 1 year ago • 9 comments

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

VadikAladik avatar Dec 24 '24 09:12 VadikAladik

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!

Revadike avatar Dec 24 '24 13:12 Revadike

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 avatar Dec 25 '24 20:12 VadikAladik

Requests are really really hard 😥

VadikAladik avatar Dec 25 '24 20:12 VadikAladik

You need to be logged in the steam web

Revadike avatar Dec 25 '24 20:12 Revadike

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

VadikAladik avatar Dec 25 '24 20:12 VadikAladik

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

Revadike avatar Dec 25 '24 20:12 Revadike

application/x-www-form-urlencoded

it didn't work 😥

VadikAladik avatar Dec 25 '24 20:12 VadikAladik

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 😥

VadikAladik avatar Dec 29 '24 13:12 VadikAladik

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

Revadike avatar Dec 29 '24 14:12 Revadike