Jump to content
McKay Development

johnnyJ

Member
  • Content Count

    10
  • Joined

  • Last visited

  1. I need add steam-api to my reacr prjct.First I'm running my project with npm start and then I launch steam-user with node steam-api.And when i import steam-user to my react prjct I receive this error https://imgur.com/4xqZZlb My files: Package.json: {"name": "steamx-app","author": "webif","description": "empty","main": "electron/main.js","version": "0.1.0","private": true,"homepage": "./","scripts": {"start": "nf start","steam-api": "node src/steam-api.js","react-start": "react-scripts start","electron-start": "node electron-wait-react","build": "react-scripts build","test": "react-scripts test --env=jsdom","eject": "react-scripts eject","electron": "electron .","ebuild": "yarn build && node_modules/.bin/build"},"build": {"productName": "steamX","appId": "com.steamx.app","extends": null,"electronVersion": "2.0.4","files": ["build/**/*","electron/*"]},"dependencies": {"electron-titlebar": "0.0.3","react": "^16.4.1","react-dom": "^16.4.1","react-router-dom": "^4.3.1","react-scripts": "1.1.4","readline": "^1.3.0","steam-user": "^3.27.1"},"devDependencies": {"electron": "^2.0.4","electron-builder": "^20.19.2","foreman": "^3.0.1"}}steam-api.js: const SteamUser = require('steam-user')var client = new SteamUser()reactjs file: import React, { Component } from 'react'import LoginForm from './LoginForm'import SteamGuardForm from './SteamGuardForm'import '../../steam-api.js' export default class Login extends Component {state = {accountName: "",password: "",steamGuardCode: ""} inputChangeHandler = (event) => {this.setState({[event.target.id]: event.target.value})} loginHandler = () => {// sessionStorage.setItem("promptSteamGuard", true)} render() {return(<div className="welcome-container"><LoginFormaccountName={this.state.accountName}password={this.state.password}inputChange={this.inputChangeHandler}tryLogin={this.loginHandler}/><SteamGuardFormsteamGuardCode={this.state.steamGuardCode}/></div>)}}
  2. I add reactJS to my project and I connect steam-user module and i also get this error https://i.imgur.com/46tHB1W.png I'm running my project with npm start import React, { Component } from 'react' import LoginForm from './LoginForm' import SteamGuardForm from './SteamGuardForm' const SteamUser = require('steam-user') let client = new SteamUser() export default class Login extends Component { state = { accountName: "", password: "", steamGuardCode: "" } inputChangeHandler = (event) => { this.setState({ [event.target.id]: event.target.value }) } loginHandler = () => { // sessionStorage.setItem("promptSteamGuard", true) } render() { return( <div className="welcome-container"> <LoginForm accountName={this.state.accountName} password={this.state.password} inputChange={this.inputChangeHandler} tryLogin={this.loginHandler} /> <SteamGuardForm steamGuardCode={this.state.steamGuardCode} inputChange={this.inputChangeHandler} /> </div> ) } } "scripts": { "start": "nf start", "react-start": "react-scripts start", "electron-start": "node electron-wait-react", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "electron": "electron .", "ebuild": "yarn build && node_modules/.bin/build" },
  3. Ok so now I'm using it in Node.js and my script started working with first click event but I'm still receiving that error and if I remove const SteamUser = require('steam-user'); const client = new SteamUser(); from logout() like this: const SteamUser = require('steam-user'); const client = new SteamUser(); function logout() { const remote = require('electron').remote; localStorage.setItem("userID", ""); client.logOff(); var window = remote.getCurrentWindow(); window.close(); } Im getting Uncaught ReferenceError: client is not defined
  4. Hi!When I try to use any steam-user methods I'm receiving this error https://imgur.com/4xqZZlb Code: function logout() { const remote = require('electron').remote; const SteamUser = require('steam-user'); const client = new SteamUser(); localStorage.setItem("userID", ""); client.logOff(); var window = remote.getCurrentWindow(); window.close(); } func set onclick event Methods are working but only from the second clickevent on first im getting that error.
  5. my bad i just forgot to add var SteamID = SteamCommunity.SteamID;
  6. I cant load my personal user by this method.What im doing wrong? community.getSteamUser('76561198114587613', function(err, user) { if (err) { console.log(err); } else { console.log(user); } });
  7. I set promptSteamGuardCode to false but steamGuard event still doesnt work var SteamUser = require('steam-user'); // Replace this with `require('steam-user');` if used outside of the module directory var client = new SteamUser(); client.setOption(SteamUser.promptSteamGuardCode, false); client.logOn({ "accountName": "accountName", "password": "password" }); client.on('loggedOn', function(details) { console.log("Logged into Steam as " + client.steamID.getSteam3RenderedID()); client.setPersona(SteamUser.EPersonaState.Online); client.gamesPlayed(440); setTimeout(function() { client.logOff(); console.log("Bye"); }, 3000); }); client.on('error', function(e) { // Some error occurred during logon console.log(e); }); client.on('steamGuard', function(domain, callback) { console.log("Steam Guard code needed from email ending in " + domain); console.log("dsmdsad"); var code = getCodeSomehow(); callback(code); }); client.on('webSession', function(sessionID, cookies) { console.log("Got web session"); // Do something with these cookies if you wish }); client.on('emailInfo', function(address, validated) { console.log("Our email address is " + address + " and it's " + (validated ? "validated" : "not validated")); }); client.on('wallet', function(hasWallet, currency, balance) { console.log("Our wallet balance is " + SteamUser.formatCurrency(balance, currency)); }); client.on('vacBans', function(numBans, appids) { console.log("We have " + numBans + " VAC ban" + (numBans == 1 ? '' : 's') + "."); if (appids.length > 0) { console.log("We are VAC banned from apps: " + appids.join(', ')); } });
  8. I set client.setOption(SteamUser.promptSteamGuardCode, false); and then i try to log in,but still steamGuard event doesnt working.Am i doing smth wrong?
  9. How im working now with node-steam-user and i would like to know how can i find out what user need to enter authCode or twoFactorCode when he is trying to log in with my app with logOn();
×
×
  • Create New...