steam-openid v1.1.1
Steam OpenID Web Login
Installation
It's so easy!
npm i steam-openidVersion Support
Support for versions of node.js will follow that of the request module.
Usage
import SteamOpenID from "steam-openid";
import SteamCommunity from "steamcommunity";
const openid = new SteamOpenID();
const community = new SteamCommunity();
community.login(
{
accountName: "username",
password: "password",
disableMobile: true
},
(error, sessionID, cookies) => {
if (error) throw error;
openid.setCookies(cookies);
}
);
// openid.loginWeb("https://steamcommunity.com/openid/login?openid.mode=checkid_setup&...")
openid
.loginWeb("https://csgo500.com/steam/preauth")
.then(response => console.log(response.body, response.headers, response.href, response.cookies, response.jar))
.catch(console.error);import SteamOpenID from "steam-openid";
const cookies = ["steamLoginSecure=76561198036081043%7C%7C0BF6C9BA765B006800DE2319B920A5371063F0CC", "sessionid=290eb6ead617308c28811463"];
openid.setCookies(cookies);
openid
.loginWeb("https://csgo500.com/steam/preauth")
.then(({ cookies }) => console.log(cookies))
.catch(console.error);Methods
constructor(options)
options- Optional. request options
setCookies(cookies)
cookies- An array of cookies (as name=value pair strings)
node-steamcommunity cookies logic
loginWeb(uri, cloneJar)
uri- Fully qualified uri or a parsed url object from url.parse(), can be a link that will redirect to https://steamcommunity.com/openid/login?openid.mode=checkid_setup&... likehttps://csgo500.com/steam/preauthcloneJar- Optional. By default(true) will use a copy of.jarto prevent crossing cookies
Returns
{
body: String,
headers: String[],
href: String,
jar: RequestJar,
cookies: Object
}It's better not to use jar instance due to crossing cookies
{ cookies } includes cookies from Steam domains only if cloneJar is false
getLoginForm(uri, jar)
uri- Check the usage of.loginWeb(uri, ...)jar- RequestJar with Steam cookies
Returns
{
uri: String,
data: Object
}It's better to use .loginWeb(...)
processLoginForm(uri, formData, jar)
uri- It must be https://steamcommunity.com/openid/login, however Steam can change it in futureformData- Serialized form#loginFormjar- RequestJar with Steam cookies
Returns
{
body: String,
headers: String[],
href: String,
}It's better to use .loginWeb(...)
Development
npm run clean- Removelibdirectorynpm run test- Run testsnpm run build- Babel will transpile ES6 => ES5 and minify the code.npm run prepare- Hook for npm. Do all the checks before publishing module.
License
Released under MIT license