Provides an interface for sign into 3d-party sites using Steam OpenID
Steam OpenID Web Login
Installation
It's so easy!
npm i steam-openid
Version 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)
loginWeb(uri, [cloneJar])
cloneJar - Optional. By default(true) will use a copy of .jar to 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 future
formData - Serialized form #loginForm
jar - RequestJar with Steam cookies
Returns
{
body: String,
headers: String[],
href: String,
}
It's better to use .loginWeb(...)
Development
npm run clean - Remove lib directory
npm run test - Run tests
npm 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
HomePage
Repository