Jump to content
McKay Development

BeginAuthSessionViaCredentials


mqwerty

Recommended Posts

Good afternoon. I am trying to make authorisation in steam from browser. I've encountered the following problem. Steam for some reason responds strangely to my request

Quote
{
    "response": {
        "interval": 5,
        "extended_error_message": ""
    }
}

. While sometimes I get correct data with client_id, request_id, etc.
My request looks like this image.thumb.png.54c93cacf7ad5acc8e89b03964b6a798.pngMaybe I don't know some nuances of this api?

Link to comment
Share on other sites

Hello again! I still can't find the problem for myself. I decided to reproduce your encryption method from steam-session but I still see in heders

Quote

x-eresult:5

 

import {hex2b64, Key as RSAKey} from 'node-bignumber';

getRSAKey = async (username) => {
  const result = await fetch(`https://api.steampowered.com/IAuthenticationService/GetPasswordRSAPublicKey/v1/?account_name=${username}/`, {
  method: 'GET',
  })

  const {response} = await result.json();
  return response;
}

encryptPassword = (password, rsaInfo) => {
  let key = new RSAKey();
  key.setPublic(rsaInfo.publickey_mod, rsaInfo.publickey_exp);

  return hex2b64(key.encrypt(password));
}

startSessionWithCredentials = async (username, password) => {
        const rsaKey = await getRSAKey(username);
        const encryptedPassword = encryptPassword(password, rsaKey)
        const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36';

		const result = await fetch(`https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1/`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'user-agent': userAgent,
            'origin': 'https://steamcommunity.com',
            'referer': 'https://steamcommunity.com'
        },
			body: JSON.stringify({
              account_name: username,
              encrypted_password: encryptedPassword,
              encryption_timestamp: rsaKey.timestamp,
              website_id: 'Community',
              device_friendly_name: userAgent,
              platform_type: 2
			})
        });

        console.log(await result.json())
    }

The login and password I enter are exactly valid. The login passes through steam-session. I don't understand what is wrong with my code?

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