[{"data":1,"prerenderedAt":6318},["ShallowReactive",2],{"articles":3},[4,852,3783,4161,4416],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"date":11,"image":12,"tags":13,"body":18,"_type":846,"_id":847,"_source":848,"_file":849,"_stem":850,"_extension":851},"\u002Farticles\u002Fsetting-up-postgresql-on-a-ubuntu-server","articles",false,"","Setting up PostgreSQL on a Ubuntu Server","Walkthrough for installing PostgreSQL on Ubuntu 24.04, creating a password-authenticated user, and setting up a project database on an EC2-style server.","2024-11-11","\u002Fimg\u002Farticles\u002Fsetting-up-postgresql-on-a-ubuntu-server\u002Fubuntu-postgres.png",[14,15,16,17],"PostgreSQL","Ubuntu","DevOps","Education",{"type":19,"children":20,"toc":840},"root",[21,30,36,43,48,82,87,120,126,131,386,405,410,439,444,458,463,479,484,489,503,516,521,535,540,548,553,567,572,580,586,591,611,616,640,659,667,672,680,685,714,719,753,766,771,777,782,796,801,809,822,827,834],{"type":22,"tag":23,"props":24,"children":25},"element","p",{},[26],{"type":22,"tag":27,"props":28,"children":29},"img",{"alt":9,"src":12},[],{"type":22,"tag":23,"props":31,"children":32},{},[33],{"type":34,"value":35},"text","Even though I mostly use docker composes for dev, and managed database solutions for prod, smaller projects might still find it useful to set up PostgreSQL locally. In this article, I'll walk through how to do it on a Ubuntu server specifically (I'll use a EC2 instance running Ubuntu 24.04.1).",{"type":22,"tag":37,"props":38,"children":40},"h2",{"id":39},"_1-installations",[41],{"type":34,"value":42},"1. Installations",{"type":22,"tag":23,"props":44,"children":45},{},[46],{"type":34,"value":47},"Firstly, we'll have to install all the packages we need, which starts with an update to our package list:",{"type":22,"tag":49,"props":50,"children":54},"pre",{"code":51,"language":52,"meta":8,"className":53,"style":8},"sudo apt update\n","bash","language-bash shiki shiki-themes github-dark",[55],{"type":22,"tag":56,"props":57,"children":58},"code",{"__ignoreMap":8},[59],{"type":22,"tag":60,"props":61,"children":64},"span",{"class":62,"line":63},"line",1,[65,71,77],{"type":22,"tag":60,"props":66,"children":68},{"style":67},"--shiki-default:#B392F0",[69],{"type":34,"value":70},"sudo",{"type":22,"tag":60,"props":72,"children":74},{"style":73},"--shiki-default:#9ECBFF",[75],{"type":34,"value":76}," apt",{"type":22,"tag":60,"props":78,"children":79},{"style":73},[80],{"type":34,"value":81}," update\n",{"type":22,"tag":23,"props":83,"children":84},{},[85],{"type":34,"value":86},"Run the following command to install PostgreSQL:",{"type":22,"tag":49,"props":88,"children":90},{"code":89,"language":52,"meta":8,"className":53,"style":8},"sudo apt install postgresql postgresql-contrib\n",[91],{"type":22,"tag":56,"props":92,"children":93},{"__ignoreMap":8},[94],{"type":22,"tag":60,"props":95,"children":96},{"class":62,"line":63},[97,101,105,110,115],{"type":22,"tag":60,"props":98,"children":99},{"style":67},[100],{"type":34,"value":70},{"type":22,"tag":60,"props":102,"children":103},{"style":73},[104],{"type":34,"value":76},{"type":22,"tag":60,"props":106,"children":107},{"style":73},[108],{"type":34,"value":109}," install",{"type":22,"tag":60,"props":111,"children":112},{"style":73},[113],{"type":34,"value":114}," postgresql",{"type":22,"tag":60,"props":116,"children":117},{"style":73},[118],{"type":34,"value":119}," postgresql-contrib\n",{"type":22,"tag":37,"props":121,"children":123},{"id":122},"_2-setting-up-a-user",[124],{"type":34,"value":125},"2. Setting up a user",{"type":22,"tag":23,"props":127,"children":128},{},[129],{"type":34,"value":130},"Accessing the database is done with a user. In a NodeJS application it might look something like this:",{"type":22,"tag":49,"props":132,"children":136},{"code":133,"language":134,"meta":8,"className":135,"style":8},"import { Pool } from 'pg';\nimport dotenv from 'dotenv';\ndotenv.config();\n\nexport const pool = new Pool({\n    user: process.env.POSTGRES_USER,\n    host: process.env.POSTGRES_HOST,\n    database: process.env.POSTGRES_DATABASE,\n    password: process.env.POSTGRES_PASSWORD,\n    port: parseInt(process.env.POSTGRES_PORT as string),\n});\n","typescript","language-typescript shiki shiki-themes github-dark",[137],{"type":22,"tag":56,"props":138,"children":139},{"__ignoreMap":8},[140,170,196,215,225,265,284,302,320,338,377],{"type":22,"tag":60,"props":141,"children":142},{"class":62,"line":63},[143,149,155,160,165],{"type":22,"tag":60,"props":144,"children":146},{"style":145},"--shiki-default:#F97583",[147],{"type":34,"value":148},"import",{"type":22,"tag":60,"props":150,"children":152},{"style":151},"--shiki-default:#E1E4E8",[153],{"type":34,"value":154}," { Pool } ",{"type":22,"tag":60,"props":156,"children":157},{"style":145},[158],{"type":34,"value":159},"from",{"type":22,"tag":60,"props":161,"children":162},{"style":73},[163],{"type":34,"value":164}," 'pg'",{"type":22,"tag":60,"props":166,"children":167},{"style":151},[168],{"type":34,"value":169},";\n",{"type":22,"tag":60,"props":171,"children":173},{"class":62,"line":172},2,[174,178,183,187,192],{"type":22,"tag":60,"props":175,"children":176},{"style":145},[177],{"type":34,"value":148},{"type":22,"tag":60,"props":179,"children":180},{"style":151},[181],{"type":34,"value":182}," dotenv ",{"type":22,"tag":60,"props":184,"children":185},{"style":145},[186],{"type":34,"value":159},{"type":22,"tag":60,"props":188,"children":189},{"style":73},[190],{"type":34,"value":191}," 'dotenv'",{"type":22,"tag":60,"props":193,"children":194},{"style":151},[195],{"type":34,"value":169},{"type":22,"tag":60,"props":197,"children":199},{"class":62,"line":198},3,[200,205,210],{"type":22,"tag":60,"props":201,"children":202},{"style":151},[203],{"type":34,"value":204},"dotenv.",{"type":22,"tag":60,"props":206,"children":207},{"style":67},[208],{"type":34,"value":209},"config",{"type":22,"tag":60,"props":211,"children":212},{"style":151},[213],{"type":34,"value":214},"();\n",{"type":22,"tag":60,"props":216,"children":218},{"class":62,"line":217},4,[219],{"type":22,"tag":60,"props":220,"children":222},{"emptyLinePlaceholder":221},true,[223],{"type":34,"value":224},"\n",{"type":22,"tag":60,"props":226,"children":228},{"class":62,"line":227},5,[229,234,239,245,250,255,260],{"type":22,"tag":60,"props":230,"children":231},{"style":145},[232],{"type":34,"value":233},"export",{"type":22,"tag":60,"props":235,"children":236},{"style":145},[237],{"type":34,"value":238}," const",{"type":22,"tag":60,"props":240,"children":242},{"style":241},"--shiki-default:#79B8FF",[243],{"type":34,"value":244}," pool",{"type":22,"tag":60,"props":246,"children":247},{"style":145},[248],{"type":34,"value":249}," =",{"type":22,"tag":60,"props":251,"children":252},{"style":145},[253],{"type":34,"value":254}," new",{"type":22,"tag":60,"props":256,"children":257},{"style":67},[258],{"type":34,"value":259}," Pool",{"type":22,"tag":60,"props":261,"children":262},{"style":151},[263],{"type":34,"value":264},"({\n",{"type":22,"tag":60,"props":266,"children":268},{"class":62,"line":267},6,[269,274,279],{"type":22,"tag":60,"props":270,"children":271},{"style":151},[272],{"type":34,"value":273},"    user: process.env.",{"type":22,"tag":60,"props":275,"children":276},{"style":241},[277],{"type":34,"value":278},"POSTGRES_USER",{"type":22,"tag":60,"props":280,"children":281},{"style":151},[282],{"type":34,"value":283},",\n",{"type":22,"tag":60,"props":285,"children":287},{"class":62,"line":286},7,[288,293,298],{"type":22,"tag":60,"props":289,"children":290},{"style":151},[291],{"type":34,"value":292},"    host: process.env.",{"type":22,"tag":60,"props":294,"children":295},{"style":241},[296],{"type":34,"value":297},"POSTGRES_HOST",{"type":22,"tag":60,"props":299,"children":300},{"style":151},[301],{"type":34,"value":283},{"type":22,"tag":60,"props":303,"children":305},{"class":62,"line":304},8,[306,311,316],{"type":22,"tag":60,"props":307,"children":308},{"style":151},[309],{"type":34,"value":310},"    database: process.env.",{"type":22,"tag":60,"props":312,"children":313},{"style":241},[314],{"type":34,"value":315},"POSTGRES_DATABASE",{"type":22,"tag":60,"props":317,"children":318},{"style":151},[319],{"type":34,"value":283},{"type":22,"tag":60,"props":321,"children":323},{"class":62,"line":322},9,[324,329,334],{"type":22,"tag":60,"props":325,"children":326},{"style":151},[327],{"type":34,"value":328},"    password: process.env.",{"type":22,"tag":60,"props":330,"children":331},{"style":241},[332],{"type":34,"value":333},"POSTGRES_PASSWORD",{"type":22,"tag":60,"props":335,"children":336},{"style":151},[337],{"type":34,"value":283},{"type":22,"tag":60,"props":339,"children":341},{"class":62,"line":340},10,[342,347,352,357,362,367,372],{"type":22,"tag":60,"props":343,"children":344},{"style":151},[345],{"type":34,"value":346},"    port: ",{"type":22,"tag":60,"props":348,"children":349},{"style":67},[350],{"type":34,"value":351},"parseInt",{"type":22,"tag":60,"props":353,"children":354},{"style":151},[355],{"type":34,"value":356},"(process.env.",{"type":22,"tag":60,"props":358,"children":359},{"style":241},[360],{"type":34,"value":361},"POSTGRES_PORT",{"type":22,"tag":60,"props":363,"children":364},{"style":145},[365],{"type":34,"value":366}," as",{"type":22,"tag":60,"props":368,"children":369},{"style":241},[370],{"type":34,"value":371}," string",{"type":22,"tag":60,"props":373,"children":374},{"style":151},[375],{"type":34,"value":376},"),\n",{"type":22,"tag":60,"props":378,"children":380},{"class":62,"line":379},11,[381],{"type":22,"tag":60,"props":382,"children":383},{"style":151},[384],{"type":34,"value":385},"});\n",{"type":22,"tag":23,"props":387,"children":388},{},[389,391,396,398,403],{"type":34,"value":390},"As such, we'll have to make sure we create a user with the ",{"type":22,"tag":56,"props":392,"children":394},{"className":393},[],[395],{"type":34,"value":278},{"type":34,"value":397}," and ",{"type":22,"tag":56,"props":399,"children":401},{"className":400},[],[402],{"type":34,"value":333},{"type":34,"value":404}," we've added to the application's environment variables.",{"type":22,"tag":23,"props":406,"children":407},{},[408],{"type":34,"value":409},"To access the Postgres database, we'll have to switch user to the one created during installation:",{"type":22,"tag":49,"props":411,"children":413},{"code":412,"language":52,"meta":8,"className":53,"style":8},"sudo -i -u postgres\n",[414],{"type":22,"tag":56,"props":415,"children":416},{"__ignoreMap":8},[417],{"type":22,"tag":60,"props":418,"children":419},{"class":62,"line":63},[420,424,429,434],{"type":22,"tag":60,"props":421,"children":422},{"style":67},[423],{"type":34,"value":70},{"type":22,"tag":60,"props":425,"children":426},{"style":241},[427],{"type":34,"value":428}," -i",{"type":22,"tag":60,"props":430,"children":431},{"style":241},[432],{"type":34,"value":433}," -u",{"type":22,"tag":60,"props":435,"children":436},{"style":73},[437],{"type":34,"value":438}," postgres\n",{"type":22,"tag":23,"props":440,"children":441},{},[442],{"type":34,"value":443},"And then access the shell by using:",{"type":22,"tag":49,"props":445,"children":447},{"code":446,"language":52,"meta":8,"className":53,"style":8},"psql\n",[448],{"type":22,"tag":56,"props":449,"children":450},{"__ignoreMap":8},[451],{"type":22,"tag":60,"props":452,"children":453},{"class":62,"line":63},[454],{"type":22,"tag":60,"props":455,"children":456},{"style":67},[457],{"type":34,"value":446},{"type":22,"tag":23,"props":459,"children":460},{},[461],{"type":34,"value":462},"In the shell, we'll create our user:",{"type":22,"tag":49,"props":464,"children":468},{"code":465,"language":466,"meta":8,"className":467,"style":8},"CREATE USER tf2bot WITH PASSWORD '50d56046-0d01-4865-901c-a9b3fac8e1f8';\n","sql","language-sql shiki shiki-themes github-dark",[469],{"type":22,"tag":56,"props":470,"children":471},{"__ignoreMap":8},[472],{"type":22,"tag":60,"props":473,"children":474},{"class":62,"line":63},[475],{"type":22,"tag":60,"props":476,"children":477},{},[478],{"type":34,"value":465},{"type":22,"tag":23,"props":480,"children":481},{},[482],{"type":34,"value":483},"(you can change the username and password to whatever fits your application best. In this case it will be used for a TF2 Steam bot).",{"type":22,"tag":23,"props":485,"children":486},{},[487],{"type":34,"value":488},"Instead of creating the database with the default user and changing owner, I like to allow the newly created user to create databases:",{"type":22,"tag":49,"props":490,"children":492},{"code":491,"language":466,"meta":8,"className":467,"style":8},"ALTER USER tf2bot CREATEDB;\n",[493],{"type":22,"tag":56,"props":494,"children":495},{"__ignoreMap":8},[496],{"type":22,"tag":60,"props":497,"children":498},{"class":62,"line":63},[499],{"type":22,"tag":60,"props":500,"children":501},{},[502],{"type":34,"value":491},{"type":22,"tag":23,"props":504,"children":505},{},[506,508,514],{"type":34,"value":507},"(change ",{"type":22,"tag":56,"props":509,"children":511},{"className":510},[],[512],{"type":34,"value":513},"tf2bot",{"type":34,"value":515}," to the username you used in the previous step)",{"type":22,"tag":23,"props":517,"children":518},{},[519],{"type":34,"value":520},"For the next step, we need to locate a configuration file. This is easily done using the following command:",{"type":22,"tag":49,"props":522,"children":524},{"code":523,"language":466,"meta":8,"className":467,"style":8},"SHOW hba_file;\n",[525],{"type":22,"tag":56,"props":526,"children":527},{"__ignoreMap":8},[528],{"type":22,"tag":60,"props":529,"children":530},{"class":62,"line":63},[531],{"type":22,"tag":60,"props":532,"children":533},{},[534],{"type":34,"value":523},{"type":22,"tag":23,"props":536,"children":537},{},[538],{"type":34,"value":539},"That should print something like:",{"type":22,"tag":49,"props":541,"children":543},{"code":542},"              hba_file\n-------------------------------------\n \u002Fetc\u002Fpostgresql\u002F16\u002Fmain\u002Fpg_hba.conf\n(1 row)\n",[544],{"type":22,"tag":56,"props":545,"children":546},{"__ignoreMap":8},[547],{"type":34,"value":542},{"type":22,"tag":23,"props":549,"children":550},{},[551],{"type":34,"value":552},"Let's exit the shell for now:",{"type":22,"tag":49,"props":554,"children":556},{"code":555,"language":52,"meta":8,"className":53,"style":8},"\\q\n",[557],{"type":22,"tag":56,"props":558,"children":559},{"__ignoreMap":8},[560],{"type":22,"tag":60,"props":561,"children":562},{"class":62,"line":63},[563],{"type":22,"tag":60,"props":564,"children":565},{"style":67},[566],{"type":34,"value":555},{"type":22,"tag":23,"props":568,"children":569},{},[570],{"type":34,"value":571},"And then ctrl + D to go back to our root user.",{"type":22,"tag":49,"props":573,"children":575},{"code":574},"ctrl + D\n",[576],{"type":22,"tag":56,"props":577,"children":578},{"__ignoreMap":8},[579],{"type":34,"value":574},{"type":22,"tag":37,"props":581,"children":583},{"id":582},"_3-configuring-postgres-to-allow-sign-in-with-password",[584],{"type":34,"value":585},"3. Configuring Postgres to allow sign in with password",{"type":22,"tag":23,"props":587,"children":588},{},[589],{"type":34,"value":590},"Depending on what was printed in the previous step, the following command might look different (depending on postgres version, etc.) Excluding the final file, let's navigate to the directory within which it resides:",{"type":22,"tag":49,"props":592,"children":594},{"code":593,"language":52,"meta":8,"className":53,"style":8},"cd \u002Fetc\u002Fpostgresql\u002F16\u002Fmain\u002F\n",[595],{"type":22,"tag":56,"props":596,"children":597},{"__ignoreMap":8},[598],{"type":22,"tag":60,"props":599,"children":600},{"class":62,"line":63},[601,606],{"type":22,"tag":60,"props":602,"children":603},{"style":241},[604],{"type":34,"value":605},"cd",{"type":22,"tag":60,"props":607,"children":608},{"style":73},[609],{"type":34,"value":610}," \u002Fetc\u002Fpostgresql\u002F16\u002Fmain\u002F\n",{"type":22,"tag":23,"props":612,"children":613},{},[614],{"type":34,"value":615},"To edit the file of interest, we'll utilize nano:",{"type":22,"tag":49,"props":617,"children":619},{"code":618,"language":52,"meta":8,"className":53,"style":8},"sudo nano pg_hba.conf\n",[620],{"type":22,"tag":56,"props":621,"children":622},{"__ignoreMap":8},[623],{"type":22,"tag":60,"props":624,"children":625},{"class":62,"line":63},[626,630,635],{"type":22,"tag":60,"props":627,"children":628},{"style":67},[629],{"type":34,"value":70},{"type":22,"tag":60,"props":631,"children":632},{"style":73},[633],{"type":34,"value":634}," nano",{"type":22,"tag":60,"props":636,"children":637},{"style":73},[638],{"type":34,"value":639}," pg_hba.conf\n",{"type":22,"tag":23,"props":641,"children":642},{},[643,645,651,653],{"type":34,"value":644},"Scroll down to the following line and change ",{"type":22,"tag":56,"props":646,"children":648},{"className":647},[],[649],{"type":34,"value":650},"peer",{"type":34,"value":652}," to ",{"type":22,"tag":56,"props":654,"children":656},{"className":655},[],[657],{"type":34,"value":658},"scram-sha-256",{"type":22,"tag":49,"props":660,"children":662},{"code":661},"# \"local\" is for Unix domain socket connections only\nlocal   all             all                                peer\n",[663],{"type":22,"tag":56,"props":664,"children":665},{"__ignoreMap":8},[666],{"type":34,"value":661},{"type":22,"tag":23,"props":668,"children":669},{},[670],{"type":34,"value":671},"It should look like this when you're done:",{"type":22,"tag":49,"props":673,"children":675},{"code":674},"# \"local\" is for Unix domain socket connections only\nlocal   all             all                                scram-sha-256\n",[676],{"type":22,"tag":56,"props":677,"children":678},{"__ignoreMap":8},[679],{"type":34,"value":674},{"type":22,"tag":23,"props":681,"children":682},{},[683],{"type":34,"value":684},"Afterwards, we'll have to restart postgres:",{"type":22,"tag":49,"props":686,"children":688},{"code":687,"language":52,"meta":8,"className":53,"style":8},"sudo systemctl restart postgresql\n",[689],{"type":22,"tag":56,"props":690,"children":691},{"__ignoreMap":8},[692],{"type":22,"tag":60,"props":693,"children":694},{"class":62,"line":63},[695,699,704,709],{"type":22,"tag":60,"props":696,"children":697},{"style":67},[698],{"type":34,"value":70},{"type":22,"tag":60,"props":700,"children":701},{"style":73},[702],{"type":34,"value":703}," systemctl",{"type":22,"tag":60,"props":705,"children":706},{"style":73},[707],{"type":34,"value":708}," restart",{"type":22,"tag":60,"props":710,"children":711},{"style":73},[712],{"type":34,"value":713}," postgresql\n",{"type":22,"tag":23,"props":715,"children":716},{},[717],{"type":34,"value":718},"If all went well, you should now be able to directly sign in to the user you created:",{"type":22,"tag":49,"props":720,"children":722},{"code":721,"language":52,"meta":8,"className":53,"style":8},"psql -U tf2bot -d postgres\n",[723],{"type":22,"tag":56,"props":724,"children":725},{"__ignoreMap":8},[726],{"type":22,"tag":60,"props":727,"children":728},{"class":62,"line":63},[729,734,739,744,749],{"type":22,"tag":60,"props":730,"children":731},{"style":67},[732],{"type":34,"value":733},"psql",{"type":22,"tag":60,"props":735,"children":736},{"style":241},[737],{"type":34,"value":738}," -U",{"type":22,"tag":60,"props":740,"children":741},{"style":73},[742],{"type":34,"value":743}," tf2bot",{"type":22,"tag":60,"props":745,"children":746},{"style":241},[747],{"type":34,"value":748}," -d",{"type":22,"tag":60,"props":750,"children":751},{"style":73},[752],{"type":34,"value":438},{"type":22,"tag":23,"props":754,"children":755},{},[756,758,764],{"type":34,"value":757},"You'll be prompted for a password, enter the one you added during setup (in my case ",{"type":22,"tag":56,"props":759,"children":761},{"className":760},[],[762],{"type":34,"value":763},"50d56046-0d01-4865-901c-a9b3fac8e1f8",{"type":34,"value":765},")",{"type":22,"tag":23,"props":767,"children":768},{},[769],{"type":34,"value":770},"Remain in the shell and move on to step 4.",{"type":22,"tag":37,"props":772,"children":774},{"id":773},"_4-adding-our-database",[775],{"type":34,"value":776},"4. Adding our database",{"type":22,"tag":23,"props":778,"children":779},{},[780],{"type":34,"value":781},"To add a database to postgres, use the following command:",{"type":22,"tag":49,"props":783,"children":785},{"code":784,"language":466,"meta":8,"className":467,"style":8},"CREATE DATABASE tf2bot;\n",[786],{"type":22,"tag":56,"props":787,"children":788},{"__ignoreMap":8},[789],{"type":22,"tag":60,"props":790,"children":791},{"class":62,"line":63},[792],{"type":22,"tag":60,"props":793,"children":794},{},[795],{"type":34,"value":784},{"type":22,"tag":23,"props":797,"children":798},{},[799],{"type":34,"value":800},"Afterwards, you can connect to the database using:",{"type":22,"tag":49,"props":802,"children":804},{"code":803},"\\c tf2bot;\n",[805],{"type":22,"tag":56,"props":806,"children":807},{"__ignoreMap":8},[808],{"type":34,"value":803},{"type":22,"tag":23,"props":810,"children":811},{},[812,814,820],{"type":34,"value":813},"In here, paste the ",{"type":22,"tag":815,"props":816,"children":817},"strong",{},[818],{"type":34,"value":819},"database.sql",{"type":34,"value":821}," file of your project, and you'll be good to go!",{"type":22,"tag":23,"props":823,"children":824},{},[825],{"type":34,"value":826},"Exit the postgres shell when you are done:",{"type":22,"tag":49,"props":828,"children":829},{"code":555},[830],{"type":22,"tag":56,"props":831,"children":832},{"__ignoreMap":8},[833],{"type":34,"value":555},{"type":22,"tag":835,"props":836,"children":837},"style",{},[838],{"type":34,"value":839},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":8,"searchDepth":172,"depth":172,"links":841},[842,843,844,845],{"id":39,"depth":172,"text":42},{"id":122,"depth":172,"text":125},{"id":582,"depth":172,"text":585},{"id":773,"depth":172,"text":776},"markdown","content:articles:setting-up-postgresql-on-a-ubuntu-server.md","content","articles\u002Fsetting-up-postgresql-on-a-ubuntu-server.md","articles\u002Fsetting-up-postgresql-on-a-ubuntu-server","md",{"_path":853,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":854,"description":855,"date":856,"image":857,"tags":858,"body":862,"_type":846,"_id":3780,"_source":848,"_file":3781,"_stem":3782,"_extension":851},"\u002Farticles\u002Fcs2-inventory-with-floats-using-csinventoryapi-nodejs","[DEPRECATED] Fetch CS2 Inventory with Floats using CSInventoryAPI (NodeJS)","Deprecated guide: fetch CS2 inventory floats with CSInventoryAPI’s inspect endpoint in NodeJS. Valve inspect-link changes from March 2026 broke this flow.","2024-10-11","\u002Fimg\u002Farticles\u002Fcs2-inventory-with-floats\u002Fitem-floats.jpg",[859,860,861,17],"Steam","CS2","NodeJS",{"type":19,"children":863,"toc":3770},[864,871,892,912,918,931,939,944,952,965,970,1019,1025,1038,1043,1051,1056,1064,1071,1077,1090,1104,1111,1116,1735,1740,1746,1751,2277,2290,2295,2377,2382,2632,2645,2651,2656,3429,3441,3446,3743,3749,3754,3766],{"type":22,"tag":23,"props":865,"children":866},{},[867],{"type":22,"tag":27,"props":868,"children":870},{"alt":869,"src":857},"Fetch CS2 Inventory with Floats using CSInventoryAPI",[],{"type":22,"tag":23,"props":872,"children":873},{},[874,879,881,890],{"type":22,"tag":815,"props":875,"children":876},{},[877],{"type":34,"value":878},"Update March 14th, 2026:",{"type":34,"value":880}," Valve pushed an update to inspect links last night, rendering this guide deprecated. After updating ",{"type":22,"tag":882,"props":883,"children":887},"a",{"href":884,"rel":885},"https:\u002F\u002Fcsinventoryapi.com\u002F",[886],"nofollow",[888],{"type":34,"value":889},"CSInventoryAPI",{"type":34,"value":891}," I'll probably add a new blog post explaining the changes paired with a new guide.",{"type":22,"tag":23,"props":893,"children":894},{},[895,897,902,904,910],{"type":34,"value":896},"In an attempt to make ",{"type":22,"tag":882,"props":898,"children":900},{"href":884,"rel":899},[886],[901],{"type":34,"value":889},{"type":34,"value":903}," more accessible, I figured I would put together a quick article detailing how to successfully use our most popular endpoint, the inspect API (",{"type":22,"tag":56,"props":905,"children":907},{"className":906},[],[908],{"type":34,"value":909},"\u002Fapi\u002Fv1\u002Finspect",{"type":34,"value":911},").",{"type":22,"tag":37,"props":913,"children":915},{"id":914},"the-url-property",[916],{"type":34,"value":917},"The ?url= property",{"type":22,"tag":23,"props":919,"children":920},{},[921,923,929],{"type":34,"value":922},"The only thing we need to obtain the advanced item info for a specific item is the ",{"type":22,"tag":924,"props":925,"children":926},"em",{},[927],{"type":34,"value":928},"inspect url",{"type":34,"value":930},", most easily found by navigating to your own inventory, clicking an item, and finding the \"Inspect in Game...\" button.",{"type":22,"tag":23,"props":932,"children":933},{},[934],{"type":22,"tag":27,"props":935,"children":938},{"alt":936,"src":937},"Inspect in Game link in a CS2 inventory","\u002Fimg\u002Farticles\u002Fcs2-inventory-with-floats\u002Finspect-in-game.png",[],{"type":22,"tag":23,"props":940,"children":941},{},[942],{"type":34,"value":943},"If you copy that link address, you will find something with a close resemblance to:",{"type":22,"tag":49,"props":945,"children":947},{"code":946},"steam:\u002F\u002Frungame\u002F730\u002F76561202255233023\u002F+csgo_econ_action_preview%20S76561198166295458A38739886639D768787693327487156\n",[948],{"type":22,"tag":56,"props":949,"children":950},{"__ignoreMap":8},[951],{"type":34,"value":946},{"type":22,"tag":23,"props":953,"children":954},{},[955,957,963],{"type":34,"value":956},"Now, the most important parts of this url is what happens near the end, after the ",{"type":22,"tag":56,"props":958,"children":960},{"className":959},[],[961],{"type":34,"value":962},"%20",{"type":34,"value":964}," (space).",{"type":22,"tag":23,"props":966,"children":967},{},[968],{"type":34,"value":969},"There are three letters that separate the different sequences of numbers:",{"type":22,"tag":971,"props":972,"children":973},"ul",{},[974,992,1009],{"type":22,"tag":975,"props":976,"children":977},"li",{},[978,983,985,991],{"type":22,"tag":815,"props":979,"children":980},{},[981],{"type":34,"value":982},"S",{"type":34,"value":984}," (steamid64, in this case ",{"type":22,"tag":56,"props":986,"children":988},{"className":987},[],[989],{"type":34,"value":990},"76561198166295458",{"type":34,"value":765},{"type":22,"tag":975,"props":993,"children":994},{},[995,1000,1002,1008],{"type":22,"tag":815,"props":996,"children":997},{},[998],{"type":34,"value":999},"A",{"type":34,"value":1001}," (assetid of the item, in this case ",{"type":22,"tag":56,"props":1003,"children":1005},{"className":1004},[],[1006],{"type":34,"value":1007},"38739886639",{"type":34,"value":765},{"type":22,"tag":975,"props":1010,"children":1011},{},[1012,1017],{"type":22,"tag":815,"props":1013,"children":1014},{},[1015],{"type":34,"value":1016},"D",{"type":34,"value":1018}," (a random number as far as I know, we will not have to worry about this).",{"type":22,"tag":37,"props":1020,"children":1022},{"id":1021},"testing-the-inspect-endpoint",[1023],{"type":34,"value":1024},"Testing the inspect endpoint",{"type":22,"tag":23,"props":1026,"children":1027},{},[1028,1030,1036],{"type":34,"value":1029},"Armed with this inspect link, you can try out the endpoint using the swagger UI available at ",{"type":22,"tag":882,"props":1031,"children":1034},{"href":1032,"rel":1033},"https:\u002F\u002Fcsinventoryapi.com\u002Fdocs",[886],[1035],{"type":34,"value":1032},{"type":34,"value":1037},".",{"type":22,"tag":23,"props":1039,"children":1040},{},[1041],{"type":34,"value":1042},"Add your API key and the url, then press execute.",{"type":22,"tag":23,"props":1044,"children":1045},{},[1046],{"type":22,"tag":27,"props":1047,"children":1050},{"alt":1048,"src":1049},"CSInventoryAPI swagger UI inspect endpoint","\u002Fimg\u002Farticles\u002Fcs2-inventory-with-floats\u002Fswagger-inspect.png",[],{"type":22,"tag":23,"props":1052,"children":1053},{},[1054],{"type":34,"value":1055},"If all works well, you should receive an output similar to this:",{"type":22,"tag":23,"props":1057,"children":1058},{},[1059],{"type":22,"tag":27,"props":1060,"children":1063},{"alt":1061,"src":1062},"Inspect API response showing floatvalue","\u002Fimg\u002Farticles\u002Fcs2-inventory-with-floats\u002Finspect-response.png",[],{"type":22,"tag":23,"props":1065,"children":1068},{"className":1066},[1067],"img-caption",[1069],{"type":34,"value":1070},"\"floatvalue\" is the property that shows the float of the item in question.",{"type":22,"tag":37,"props":1072,"children":1074},{"id":1073},"fetching-floats-of-items-in-an-inventory-using-nodejs",[1075],{"type":34,"value":1076},"Fetching floats of items in an inventory using NodeJS",{"type":22,"tag":23,"props":1078,"children":1079},{},[1080,1082,1088],{"type":34,"value":1081},"The crux of it is, when fetching an inventory (e.g., by using the ",{"type":22,"tag":882,"props":1083,"children":1086},{"href":1084,"rel":1085},"https:\u002F\u002Fcsinventoryapi.com\u002Fapi\u002Fv1\u002Finventory",[886],[1087],{"type":34,"value":1084},{"type":34,"value":1089}," endpoint), the inspect url does not come pre-populated with the fields required to inspect the item, specifically the S and A properties are only filled with placeholders.",{"type":22,"tag":23,"props":1091,"children":1092},{},[1093,1095,1102],{"type":34,"value":1094},"The solution to this is however relatively straightforward. The S property is set to the steamid64 of the item's owner, and the A property is populated with the item's assetid. Let us see how to do this in practice (all code will be available on ",{"type":22,"tag":882,"props":1096,"children":1099},{"href":1097,"rel":1098},"https:\u002F\u002Fgithub.com\u002Fjkmsolutions\u002Finventory-with-floats",[886],[1100],{"type":34,"value":1101},"GitHub",{"type":34,"value":1103},"):",{"type":22,"tag":1105,"props":1106,"children":1108},"h3",{"id":1107},"get-user-inventory",[1109],{"type":34,"value":1110},"Get user inventory",{"type":22,"tag":23,"props":1112,"children":1113},{},[1114],{"type":34,"value":1115},"Firstly, we'll build a method to retrieve a user's inventory (also using CSInventoryAPI to avoid rate limits imposed by Steam):",{"type":22,"tag":49,"props":1117,"children":1121},{"code":1118,"language":1119,"meta":8,"className":1120,"style":8},"import axios from 'axios';\n\nconst API_KEY = process.env.CSINVENTORYAPI_API_KEY;\n\nif (!API_KEY) {\n    throw new Error('No API key provided');\n}\n\n\u002F**\n * Fetches the inventory of a user\n *\n * @param {string} steamid64 of the user\n * @returns {Promise\u003CInventory>} the user's inventory\n *\u002F\nconst getUserInventory = async (steamid64) => {\n    const response = await axios.get(\n        `https:\u002F\u002Fcsinventoryapi.com\u002Fapi\u002Fv1\u002Finventory?api_key=${API_KEY}&steamid64=${steamid64}`\n    );\n\n    if (response.data.success !== 1) {\n        throw new Error('Failed to fetch inventory');\n    }\n\n    if (response.data.total_inventory_count === 0) {\n        throw new Error('No items found.');\n    }\n\n    if (!response.data.assets || !response.data.descriptions) {\n        throw new Error('No assets found.');\n    }\n\n    return response.data;\n}\n","javascript","language-javascript shiki shiki-themes github-dark",[1122],{"type":22,"tag":56,"props":1123,"children":1124},{"__ignoreMap":8},[1125,1150,1157,1188,1195,1223,1255,1263,1270,1279,1287,1295,1324,1347,1356,1403,1441,1468,1477,1485,1513,1543,1552,1560,1587,1616,1624,1632,1668,1697,1705,1713,1727],{"type":22,"tag":60,"props":1126,"children":1127},{"class":62,"line":63},[1128,1132,1137,1141,1146],{"type":22,"tag":60,"props":1129,"children":1130},{"style":145},[1131],{"type":34,"value":148},{"type":22,"tag":60,"props":1133,"children":1134},{"style":151},[1135],{"type":34,"value":1136}," axios ",{"type":22,"tag":60,"props":1138,"children":1139},{"style":145},[1140],{"type":34,"value":159},{"type":22,"tag":60,"props":1142,"children":1143},{"style":73},[1144],{"type":34,"value":1145}," 'axios'",{"type":22,"tag":60,"props":1147,"children":1148},{"style":151},[1149],{"type":34,"value":169},{"type":22,"tag":60,"props":1151,"children":1152},{"class":62,"line":172},[1153],{"type":22,"tag":60,"props":1154,"children":1155},{"emptyLinePlaceholder":221},[1156],{"type":34,"value":224},{"type":22,"tag":60,"props":1158,"children":1159},{"class":62,"line":198},[1160,1165,1170,1174,1179,1184],{"type":22,"tag":60,"props":1161,"children":1162},{"style":145},[1163],{"type":34,"value":1164},"const",{"type":22,"tag":60,"props":1166,"children":1167},{"style":241},[1168],{"type":34,"value":1169}," API_KEY",{"type":22,"tag":60,"props":1171,"children":1172},{"style":145},[1173],{"type":34,"value":249},{"type":22,"tag":60,"props":1175,"children":1176},{"style":151},[1177],{"type":34,"value":1178}," process.env.",{"type":22,"tag":60,"props":1180,"children":1181},{"style":241},[1182],{"type":34,"value":1183},"CSINVENTORYAPI_API_KEY",{"type":22,"tag":60,"props":1185,"children":1186},{"style":151},[1187],{"type":34,"value":169},{"type":22,"tag":60,"props":1189,"children":1190},{"class":62,"line":217},[1191],{"type":22,"tag":60,"props":1192,"children":1193},{"emptyLinePlaceholder":221},[1194],{"type":34,"value":224},{"type":22,"tag":60,"props":1196,"children":1197},{"class":62,"line":227},[1198,1203,1208,1213,1218],{"type":22,"tag":60,"props":1199,"children":1200},{"style":145},[1201],{"type":34,"value":1202},"if",{"type":22,"tag":60,"props":1204,"children":1205},{"style":151},[1206],{"type":34,"value":1207}," (",{"type":22,"tag":60,"props":1209,"children":1210},{"style":145},[1211],{"type":34,"value":1212},"!",{"type":22,"tag":60,"props":1214,"children":1215},{"style":241},[1216],{"type":34,"value":1217},"API_KEY",{"type":22,"tag":60,"props":1219,"children":1220},{"style":151},[1221],{"type":34,"value":1222},") {\n",{"type":22,"tag":60,"props":1224,"children":1225},{"class":62,"line":267},[1226,1231,1235,1240,1245,1250],{"type":22,"tag":60,"props":1227,"children":1228},{"style":145},[1229],{"type":34,"value":1230},"    throw",{"type":22,"tag":60,"props":1232,"children":1233},{"style":145},[1234],{"type":34,"value":254},{"type":22,"tag":60,"props":1236,"children":1237},{"style":67},[1238],{"type":34,"value":1239}," Error",{"type":22,"tag":60,"props":1241,"children":1242},{"style":151},[1243],{"type":34,"value":1244},"(",{"type":22,"tag":60,"props":1246,"children":1247},{"style":73},[1248],{"type":34,"value":1249},"'No API key provided'",{"type":22,"tag":60,"props":1251,"children":1252},{"style":151},[1253],{"type":34,"value":1254},");\n",{"type":22,"tag":60,"props":1256,"children":1257},{"class":62,"line":286},[1258],{"type":22,"tag":60,"props":1259,"children":1260},{"style":151},[1261],{"type":34,"value":1262},"}\n",{"type":22,"tag":60,"props":1264,"children":1265},{"class":62,"line":304},[1266],{"type":22,"tag":60,"props":1267,"children":1268},{"emptyLinePlaceholder":221},[1269],{"type":34,"value":224},{"type":22,"tag":60,"props":1271,"children":1272},{"class":62,"line":322},[1273],{"type":22,"tag":60,"props":1274,"children":1276},{"style":1275},"--shiki-default:#6A737D",[1277],{"type":34,"value":1278},"\u002F**\n",{"type":22,"tag":60,"props":1280,"children":1281},{"class":62,"line":340},[1282],{"type":22,"tag":60,"props":1283,"children":1284},{"style":1275},[1285],{"type":34,"value":1286}," * Fetches the inventory of a user\n",{"type":22,"tag":60,"props":1288,"children":1289},{"class":62,"line":379},[1290],{"type":22,"tag":60,"props":1291,"children":1292},{"style":1275},[1293],{"type":34,"value":1294}," *\n",{"type":22,"tag":60,"props":1296,"children":1298},{"class":62,"line":1297},12,[1299,1304,1309,1314,1319],{"type":22,"tag":60,"props":1300,"children":1301},{"style":1275},[1302],{"type":34,"value":1303}," * ",{"type":22,"tag":60,"props":1305,"children":1306},{"style":145},[1307],{"type":34,"value":1308},"@param",{"type":22,"tag":60,"props":1310,"children":1311},{"style":67},[1312],{"type":34,"value":1313}," {string}",{"type":22,"tag":60,"props":1315,"children":1316},{"style":151},[1317],{"type":34,"value":1318}," steamid64",{"type":22,"tag":60,"props":1320,"children":1321},{"style":1275},[1322],{"type":34,"value":1323}," of the user\n",{"type":22,"tag":60,"props":1325,"children":1327},{"class":62,"line":1326},13,[1328,1332,1337,1342],{"type":22,"tag":60,"props":1329,"children":1330},{"style":1275},[1331],{"type":34,"value":1303},{"type":22,"tag":60,"props":1333,"children":1334},{"style":145},[1335],{"type":34,"value":1336},"@returns",{"type":22,"tag":60,"props":1338,"children":1339},{"style":67},[1340],{"type":34,"value":1341}," {Promise\u003CInventory>}",{"type":22,"tag":60,"props":1343,"children":1344},{"style":1275},[1345],{"type":34,"value":1346}," the user's inventory\n",{"type":22,"tag":60,"props":1348,"children":1350},{"class":62,"line":1349},14,[1351],{"type":22,"tag":60,"props":1352,"children":1353},{"style":1275},[1354],{"type":34,"value":1355}," *\u002F\n",{"type":22,"tag":60,"props":1357,"children":1359},{"class":62,"line":1358},15,[1360,1364,1369,1373,1378,1382,1388,1393,1398],{"type":22,"tag":60,"props":1361,"children":1362},{"style":145},[1363],{"type":34,"value":1164},{"type":22,"tag":60,"props":1365,"children":1366},{"style":67},[1367],{"type":34,"value":1368}," getUserInventory",{"type":22,"tag":60,"props":1370,"children":1371},{"style":145},[1372],{"type":34,"value":249},{"type":22,"tag":60,"props":1374,"children":1375},{"style":145},[1376],{"type":34,"value":1377}," async",{"type":22,"tag":60,"props":1379,"children":1380},{"style":151},[1381],{"type":34,"value":1207},{"type":22,"tag":60,"props":1383,"children":1385},{"style":1384},"--shiki-default:#FFAB70",[1386],{"type":34,"value":1387},"steamid64",{"type":22,"tag":60,"props":1389,"children":1390},{"style":151},[1391],{"type":34,"value":1392},") ",{"type":22,"tag":60,"props":1394,"children":1395},{"style":145},[1396],{"type":34,"value":1397},"=>",{"type":22,"tag":60,"props":1399,"children":1400},{"style":151},[1401],{"type":34,"value":1402}," {\n",{"type":22,"tag":60,"props":1404,"children":1406},{"class":62,"line":1405},16,[1407,1412,1417,1421,1426,1431,1436],{"type":22,"tag":60,"props":1408,"children":1409},{"style":145},[1410],{"type":34,"value":1411},"    const",{"type":22,"tag":60,"props":1413,"children":1414},{"style":241},[1415],{"type":34,"value":1416}," response",{"type":22,"tag":60,"props":1418,"children":1419},{"style":145},[1420],{"type":34,"value":249},{"type":22,"tag":60,"props":1422,"children":1423},{"style":145},[1424],{"type":34,"value":1425}," await",{"type":22,"tag":60,"props":1427,"children":1428},{"style":151},[1429],{"type":34,"value":1430}," axios.",{"type":22,"tag":60,"props":1432,"children":1433},{"style":67},[1434],{"type":34,"value":1435},"get",{"type":22,"tag":60,"props":1437,"children":1438},{"style":151},[1439],{"type":34,"value":1440},"(\n",{"type":22,"tag":60,"props":1442,"children":1444},{"class":62,"line":1443},17,[1445,1450,1454,1459,1463],{"type":22,"tag":60,"props":1446,"children":1447},{"style":73},[1448],{"type":34,"value":1449},"        `https:\u002F\u002Fcsinventoryapi.com\u002Fapi\u002Fv1\u002Finventory?api_key=${",{"type":22,"tag":60,"props":1451,"children":1452},{"style":241},[1453],{"type":34,"value":1217},{"type":22,"tag":60,"props":1455,"children":1456},{"style":73},[1457],{"type":34,"value":1458},"}&steamid64=${",{"type":22,"tag":60,"props":1460,"children":1461},{"style":151},[1462],{"type":34,"value":1387},{"type":22,"tag":60,"props":1464,"children":1465},{"style":73},[1466],{"type":34,"value":1467},"}`\n",{"type":22,"tag":60,"props":1469,"children":1471},{"class":62,"line":1470},18,[1472],{"type":22,"tag":60,"props":1473,"children":1474},{"style":151},[1475],{"type":34,"value":1476},"    );\n",{"type":22,"tag":60,"props":1478,"children":1480},{"class":62,"line":1479},19,[1481],{"type":22,"tag":60,"props":1482,"children":1483},{"emptyLinePlaceholder":221},[1484],{"type":34,"value":224},{"type":22,"tag":60,"props":1486,"children":1488},{"class":62,"line":1487},20,[1489,1494,1499,1504,1509],{"type":22,"tag":60,"props":1490,"children":1491},{"style":145},[1492],{"type":34,"value":1493},"    if",{"type":22,"tag":60,"props":1495,"children":1496},{"style":151},[1497],{"type":34,"value":1498}," (response.data.success ",{"type":22,"tag":60,"props":1500,"children":1501},{"style":145},[1502],{"type":34,"value":1503},"!==",{"type":22,"tag":60,"props":1505,"children":1506},{"style":241},[1507],{"type":34,"value":1508}," 1",{"type":22,"tag":60,"props":1510,"children":1511},{"style":151},[1512],{"type":34,"value":1222},{"type":22,"tag":60,"props":1514,"children":1516},{"class":62,"line":1515},21,[1517,1522,1526,1530,1534,1539],{"type":22,"tag":60,"props":1518,"children":1519},{"style":145},[1520],{"type":34,"value":1521},"        throw",{"type":22,"tag":60,"props":1523,"children":1524},{"style":145},[1525],{"type":34,"value":254},{"type":22,"tag":60,"props":1527,"children":1528},{"style":67},[1529],{"type":34,"value":1239},{"type":22,"tag":60,"props":1531,"children":1532},{"style":151},[1533],{"type":34,"value":1244},{"type":22,"tag":60,"props":1535,"children":1536},{"style":73},[1537],{"type":34,"value":1538},"'Failed to fetch inventory'",{"type":22,"tag":60,"props":1540,"children":1541},{"style":151},[1542],{"type":34,"value":1254},{"type":22,"tag":60,"props":1544,"children":1546},{"class":62,"line":1545},22,[1547],{"type":22,"tag":60,"props":1548,"children":1549},{"style":151},[1550],{"type":34,"value":1551},"    }\n",{"type":22,"tag":60,"props":1553,"children":1555},{"class":62,"line":1554},23,[1556],{"type":22,"tag":60,"props":1557,"children":1558},{"emptyLinePlaceholder":221},[1559],{"type":34,"value":224},{"type":22,"tag":60,"props":1561,"children":1563},{"class":62,"line":1562},24,[1564,1568,1573,1578,1583],{"type":22,"tag":60,"props":1565,"children":1566},{"style":145},[1567],{"type":34,"value":1493},{"type":22,"tag":60,"props":1569,"children":1570},{"style":151},[1571],{"type":34,"value":1572}," (response.data.total_inventory_count ",{"type":22,"tag":60,"props":1574,"children":1575},{"style":145},[1576],{"type":34,"value":1577},"===",{"type":22,"tag":60,"props":1579,"children":1580},{"style":241},[1581],{"type":34,"value":1582}," 0",{"type":22,"tag":60,"props":1584,"children":1585},{"style":151},[1586],{"type":34,"value":1222},{"type":22,"tag":60,"props":1588,"children":1590},{"class":62,"line":1589},25,[1591,1595,1599,1603,1607,1612],{"type":22,"tag":60,"props":1592,"children":1593},{"style":145},[1594],{"type":34,"value":1521},{"type":22,"tag":60,"props":1596,"children":1597},{"style":145},[1598],{"type":34,"value":254},{"type":22,"tag":60,"props":1600,"children":1601},{"style":67},[1602],{"type":34,"value":1239},{"type":22,"tag":60,"props":1604,"children":1605},{"style":151},[1606],{"type":34,"value":1244},{"type":22,"tag":60,"props":1608,"children":1609},{"style":73},[1610],{"type":34,"value":1611},"'No items found.'",{"type":22,"tag":60,"props":1613,"children":1614},{"style":151},[1615],{"type":34,"value":1254},{"type":22,"tag":60,"props":1617,"children":1619},{"class":62,"line":1618},26,[1620],{"type":22,"tag":60,"props":1621,"children":1622},{"style":151},[1623],{"type":34,"value":1551},{"type":22,"tag":60,"props":1625,"children":1627},{"class":62,"line":1626},27,[1628],{"type":22,"tag":60,"props":1629,"children":1630},{"emptyLinePlaceholder":221},[1631],{"type":34,"value":224},{"type":22,"tag":60,"props":1633,"children":1635},{"class":62,"line":1634},28,[1636,1640,1644,1648,1653,1658,1663],{"type":22,"tag":60,"props":1637,"children":1638},{"style":145},[1639],{"type":34,"value":1493},{"type":22,"tag":60,"props":1641,"children":1642},{"style":151},[1643],{"type":34,"value":1207},{"type":22,"tag":60,"props":1645,"children":1646},{"style":145},[1647],{"type":34,"value":1212},{"type":22,"tag":60,"props":1649,"children":1650},{"style":151},[1651],{"type":34,"value":1652},"response.data.assets ",{"type":22,"tag":60,"props":1654,"children":1655},{"style":145},[1656],{"type":34,"value":1657},"||",{"type":22,"tag":60,"props":1659,"children":1660},{"style":145},[1661],{"type":34,"value":1662}," !",{"type":22,"tag":60,"props":1664,"children":1665},{"style":151},[1666],{"type":34,"value":1667},"response.data.descriptions) {\n",{"type":22,"tag":60,"props":1669,"children":1671},{"class":62,"line":1670},29,[1672,1676,1680,1684,1688,1693],{"type":22,"tag":60,"props":1673,"children":1674},{"style":145},[1675],{"type":34,"value":1521},{"type":22,"tag":60,"props":1677,"children":1678},{"style":145},[1679],{"type":34,"value":254},{"type":22,"tag":60,"props":1681,"children":1682},{"style":67},[1683],{"type":34,"value":1239},{"type":22,"tag":60,"props":1685,"children":1686},{"style":151},[1687],{"type":34,"value":1244},{"type":22,"tag":60,"props":1689,"children":1690},{"style":73},[1691],{"type":34,"value":1692},"'No assets found.'",{"type":22,"tag":60,"props":1694,"children":1695},{"style":151},[1696],{"type":34,"value":1254},{"type":22,"tag":60,"props":1698,"children":1700},{"class":62,"line":1699},30,[1701],{"type":22,"tag":60,"props":1702,"children":1703},{"style":151},[1704],{"type":34,"value":1551},{"type":22,"tag":60,"props":1706,"children":1708},{"class":62,"line":1707},31,[1709],{"type":22,"tag":60,"props":1710,"children":1711},{"emptyLinePlaceholder":221},[1712],{"type":34,"value":224},{"type":22,"tag":60,"props":1714,"children":1716},{"class":62,"line":1715},32,[1717,1722],{"type":22,"tag":60,"props":1718,"children":1719},{"style":145},[1720],{"type":34,"value":1721},"    return",{"type":22,"tag":60,"props":1723,"children":1724},{"style":151},[1725],{"type":34,"value":1726}," response.data;\n",{"type":22,"tag":60,"props":1728,"children":1730},{"class":62,"line":1729},33,[1731],{"type":22,"tag":60,"props":1732,"children":1733},{"style":151},[1734],{"type":34,"value":1262},{"type":22,"tag":23,"props":1736,"children":1737},{},[1738],{"type":34,"value":1739},"Simple method to fetch user inventory w\u002F some error handling.",{"type":22,"tag":1105,"props":1741,"children":1743},{"id":1742},"parse-user-inventory",[1744],{"type":34,"value":1745},"Parse user inventory",{"type":22,"tag":23,"props":1747,"children":1748},{},[1749],{"type":34,"value":1750},"Armed with this data, and given that the user have items in their inventory, we can go ahead and parse it into a more manageable array of items (Steam divides the assets and the descriptions, why this is a necessary step in most applications utilising inventory fetching).",{"type":22,"tag":49,"props":1752,"children":1754},{"code":1753,"language":1119,"meta":8,"className":1120,"style":8},"\u002F**\n *\n * @param {Inventory} inventory\n * @returns {Promise\u003CParsedInventoryItem[]>}\n *\u002F\nconst parseInventory = async (inventory) => {\n    const parsedInventory = [];\n\n    for (let i = 0; i \u003C inventory.assets.length; i++) {\n        const asset = inventory.assets[i];\n        const description = inventory.descriptions.find(d => d.classid === asset.classid);\n\n        if (!description) {\n            continue;\n        }\n\n        parsedInventory.push({\n            appid: asset.appid,\n            classid: asset.classid,\n            instanceid: asset.instanceid,\n            assetid: asset.assetid,\n            contextid: asset.contextid,\n            icon_url: description.icon_url,\n            tradable: description.tradable,\n            inspect_url: description.actions && description.actions[0] && description.actions[0].link || null,\n            name: description.name,\n            market_hash_name: description.market_hash_name,\n            name_color: description.name_color\n        });\n    }\n\n    return parsedInventory;\n}\n",[1755],{"type":22,"tag":56,"props":1756,"children":1757},{"__ignoreMap":8},[1758,1765,1772,1793,1809,1816,1857,1878,1885,1950,1972,2026,2033,2054,2066,2074,2081,2098,2106,2114,2122,2130,2138,2146,2154,2212,2220,2228,2236,2244,2251,2258,2270],{"type":22,"tag":60,"props":1759,"children":1760},{"class":62,"line":63},[1761],{"type":22,"tag":60,"props":1762,"children":1763},{"style":1275},[1764],{"type":34,"value":1278},{"type":22,"tag":60,"props":1766,"children":1767},{"class":62,"line":172},[1768],{"type":22,"tag":60,"props":1769,"children":1770},{"style":1275},[1771],{"type":34,"value":1294},{"type":22,"tag":60,"props":1773,"children":1774},{"class":62,"line":198},[1775,1779,1783,1788],{"type":22,"tag":60,"props":1776,"children":1777},{"style":1275},[1778],{"type":34,"value":1303},{"type":22,"tag":60,"props":1780,"children":1781},{"style":145},[1782],{"type":34,"value":1308},{"type":22,"tag":60,"props":1784,"children":1785},{"style":67},[1786],{"type":34,"value":1787}," {Inventory}",{"type":22,"tag":60,"props":1789,"children":1790},{"style":151},[1791],{"type":34,"value":1792}," inventory\n",{"type":22,"tag":60,"props":1794,"children":1795},{"class":62,"line":217},[1796,1800,1804],{"type":22,"tag":60,"props":1797,"children":1798},{"style":1275},[1799],{"type":34,"value":1303},{"type":22,"tag":60,"props":1801,"children":1802},{"style":145},[1803],{"type":34,"value":1336},{"type":22,"tag":60,"props":1805,"children":1806},{"style":67},[1807],{"type":34,"value":1808}," {Promise\u003CParsedInventoryItem[]>}\n",{"type":22,"tag":60,"props":1810,"children":1811},{"class":62,"line":227},[1812],{"type":22,"tag":60,"props":1813,"children":1814},{"style":1275},[1815],{"type":34,"value":1355},{"type":22,"tag":60,"props":1817,"children":1818},{"class":62,"line":267},[1819,1823,1828,1832,1836,1840,1845,1849,1853],{"type":22,"tag":60,"props":1820,"children":1821},{"style":145},[1822],{"type":34,"value":1164},{"type":22,"tag":60,"props":1824,"children":1825},{"style":67},[1826],{"type":34,"value":1827}," parseInventory",{"type":22,"tag":60,"props":1829,"children":1830},{"style":145},[1831],{"type":34,"value":249},{"type":22,"tag":60,"props":1833,"children":1834},{"style":145},[1835],{"type":34,"value":1377},{"type":22,"tag":60,"props":1837,"children":1838},{"style":151},[1839],{"type":34,"value":1207},{"type":22,"tag":60,"props":1841,"children":1842},{"style":1384},[1843],{"type":34,"value":1844},"inventory",{"type":22,"tag":60,"props":1846,"children":1847},{"style":151},[1848],{"type":34,"value":1392},{"type":22,"tag":60,"props":1850,"children":1851},{"style":145},[1852],{"type":34,"value":1397},{"type":22,"tag":60,"props":1854,"children":1855},{"style":151},[1856],{"type":34,"value":1402},{"type":22,"tag":60,"props":1858,"children":1859},{"class":62,"line":286},[1860,1864,1869,1873],{"type":22,"tag":60,"props":1861,"children":1862},{"style":145},[1863],{"type":34,"value":1411},{"type":22,"tag":60,"props":1865,"children":1866},{"style":241},[1867],{"type":34,"value":1868}," parsedInventory",{"type":22,"tag":60,"props":1870,"children":1871},{"style":145},[1872],{"type":34,"value":249},{"type":22,"tag":60,"props":1874,"children":1875},{"style":151},[1876],{"type":34,"value":1877}," [];\n",{"type":22,"tag":60,"props":1879,"children":1880},{"class":62,"line":304},[1881],{"type":22,"tag":60,"props":1882,"children":1883},{"emptyLinePlaceholder":221},[1884],{"type":34,"value":224},{"type":22,"tag":60,"props":1886,"children":1887},{"class":62,"line":322},[1888,1893,1897,1902,1907,1912,1916,1921,1926,1931,1936,1941,1946],{"type":22,"tag":60,"props":1889,"children":1890},{"style":145},[1891],{"type":34,"value":1892},"    for",{"type":22,"tag":60,"props":1894,"children":1895},{"style":151},[1896],{"type":34,"value":1207},{"type":22,"tag":60,"props":1898,"children":1899},{"style":145},[1900],{"type":34,"value":1901},"let",{"type":22,"tag":60,"props":1903,"children":1904},{"style":151},[1905],{"type":34,"value":1906}," i ",{"type":22,"tag":60,"props":1908,"children":1909},{"style":145},[1910],{"type":34,"value":1911},"=",{"type":22,"tag":60,"props":1913,"children":1914},{"style":241},[1915],{"type":34,"value":1582},{"type":22,"tag":60,"props":1917,"children":1918},{"style":151},[1919],{"type":34,"value":1920},"; i ",{"type":22,"tag":60,"props":1922,"children":1923},{"style":145},[1924],{"type":34,"value":1925},"\u003C",{"type":22,"tag":60,"props":1927,"children":1928},{"style":151},[1929],{"type":34,"value":1930}," inventory.assets.",{"type":22,"tag":60,"props":1932,"children":1933},{"style":241},[1934],{"type":34,"value":1935},"length",{"type":22,"tag":60,"props":1937,"children":1938},{"style":151},[1939],{"type":34,"value":1940},"; i",{"type":22,"tag":60,"props":1942,"children":1943},{"style":145},[1944],{"type":34,"value":1945},"++",{"type":22,"tag":60,"props":1947,"children":1948},{"style":151},[1949],{"type":34,"value":1222},{"type":22,"tag":60,"props":1951,"children":1952},{"class":62,"line":340},[1953,1958,1963,1967],{"type":22,"tag":60,"props":1954,"children":1955},{"style":145},[1956],{"type":34,"value":1957},"        const",{"type":22,"tag":60,"props":1959,"children":1960},{"style":241},[1961],{"type":34,"value":1962}," asset",{"type":22,"tag":60,"props":1964,"children":1965},{"style":145},[1966],{"type":34,"value":249},{"type":22,"tag":60,"props":1968,"children":1969},{"style":151},[1970],{"type":34,"value":1971}," inventory.assets[i];\n",{"type":22,"tag":60,"props":1973,"children":1974},{"class":62,"line":379},[1975,1979,1984,1988,1993,1998,2002,2007,2012,2017,2021],{"type":22,"tag":60,"props":1976,"children":1977},{"style":145},[1978],{"type":34,"value":1957},{"type":22,"tag":60,"props":1980,"children":1981},{"style":241},[1982],{"type":34,"value":1983}," description",{"type":22,"tag":60,"props":1985,"children":1986},{"style":145},[1987],{"type":34,"value":249},{"type":22,"tag":60,"props":1989,"children":1990},{"style":151},[1991],{"type":34,"value":1992}," inventory.descriptions.",{"type":22,"tag":60,"props":1994,"children":1995},{"style":67},[1996],{"type":34,"value":1997},"find",{"type":22,"tag":60,"props":1999,"children":2000},{"style":151},[2001],{"type":34,"value":1244},{"type":22,"tag":60,"props":2003,"children":2004},{"style":1384},[2005],{"type":34,"value":2006},"d",{"type":22,"tag":60,"props":2008,"children":2009},{"style":145},[2010],{"type":34,"value":2011}," =>",{"type":22,"tag":60,"props":2013,"children":2014},{"style":151},[2015],{"type":34,"value":2016}," d.classid ",{"type":22,"tag":60,"props":2018,"children":2019},{"style":145},[2020],{"type":34,"value":1577},{"type":22,"tag":60,"props":2022,"children":2023},{"style":151},[2024],{"type":34,"value":2025}," asset.classid);\n",{"type":22,"tag":60,"props":2027,"children":2028},{"class":62,"line":1297},[2029],{"type":22,"tag":60,"props":2030,"children":2031},{"emptyLinePlaceholder":221},[2032],{"type":34,"value":224},{"type":22,"tag":60,"props":2034,"children":2035},{"class":62,"line":1326},[2036,2041,2045,2049],{"type":22,"tag":60,"props":2037,"children":2038},{"style":145},[2039],{"type":34,"value":2040},"        if",{"type":22,"tag":60,"props":2042,"children":2043},{"style":151},[2044],{"type":34,"value":1207},{"type":22,"tag":60,"props":2046,"children":2047},{"style":145},[2048],{"type":34,"value":1212},{"type":22,"tag":60,"props":2050,"children":2051},{"style":151},[2052],{"type":34,"value":2053},"description) {\n",{"type":22,"tag":60,"props":2055,"children":2056},{"class":62,"line":1349},[2057,2062],{"type":22,"tag":60,"props":2058,"children":2059},{"style":145},[2060],{"type":34,"value":2061},"            continue",{"type":22,"tag":60,"props":2063,"children":2064},{"style":151},[2065],{"type":34,"value":169},{"type":22,"tag":60,"props":2067,"children":2068},{"class":62,"line":1358},[2069],{"type":22,"tag":60,"props":2070,"children":2071},{"style":151},[2072],{"type":34,"value":2073},"        }\n",{"type":22,"tag":60,"props":2075,"children":2076},{"class":62,"line":1405},[2077],{"type":22,"tag":60,"props":2078,"children":2079},{"emptyLinePlaceholder":221},[2080],{"type":34,"value":224},{"type":22,"tag":60,"props":2082,"children":2083},{"class":62,"line":1443},[2084,2089,2094],{"type":22,"tag":60,"props":2085,"children":2086},{"style":151},[2087],{"type":34,"value":2088},"        parsedInventory.",{"type":22,"tag":60,"props":2090,"children":2091},{"style":67},[2092],{"type":34,"value":2093},"push",{"type":22,"tag":60,"props":2095,"children":2096},{"style":151},[2097],{"type":34,"value":264},{"type":22,"tag":60,"props":2099,"children":2100},{"class":62,"line":1470},[2101],{"type":22,"tag":60,"props":2102,"children":2103},{"style":151},[2104],{"type":34,"value":2105},"            appid: asset.appid,\n",{"type":22,"tag":60,"props":2107,"children":2108},{"class":62,"line":1479},[2109],{"type":22,"tag":60,"props":2110,"children":2111},{"style":151},[2112],{"type":34,"value":2113},"            classid: asset.classid,\n",{"type":22,"tag":60,"props":2115,"children":2116},{"class":62,"line":1487},[2117],{"type":22,"tag":60,"props":2118,"children":2119},{"style":151},[2120],{"type":34,"value":2121},"            instanceid: asset.instanceid,\n",{"type":22,"tag":60,"props":2123,"children":2124},{"class":62,"line":1515},[2125],{"type":22,"tag":60,"props":2126,"children":2127},{"style":151},[2128],{"type":34,"value":2129},"            assetid: asset.assetid,\n",{"type":22,"tag":60,"props":2131,"children":2132},{"class":62,"line":1545},[2133],{"type":22,"tag":60,"props":2134,"children":2135},{"style":151},[2136],{"type":34,"value":2137},"            contextid: asset.contextid,\n",{"type":22,"tag":60,"props":2139,"children":2140},{"class":62,"line":1554},[2141],{"type":22,"tag":60,"props":2142,"children":2143},{"style":151},[2144],{"type":34,"value":2145},"            icon_url: description.icon_url,\n",{"type":22,"tag":60,"props":2147,"children":2148},{"class":62,"line":1562},[2149],{"type":22,"tag":60,"props":2150,"children":2151},{"style":151},[2152],{"type":34,"value":2153},"            tradable: description.tradable,\n",{"type":22,"tag":60,"props":2155,"children":2156},{"class":62,"line":1589},[2157,2162,2167,2172,2177,2182,2186,2190,2194,2199,2203,2208],{"type":22,"tag":60,"props":2158,"children":2159},{"style":151},[2160],{"type":34,"value":2161},"            inspect_url: description.actions ",{"type":22,"tag":60,"props":2163,"children":2164},{"style":145},[2165],{"type":34,"value":2166},"&&",{"type":22,"tag":60,"props":2168,"children":2169},{"style":151},[2170],{"type":34,"value":2171}," description.actions[",{"type":22,"tag":60,"props":2173,"children":2174},{"style":241},[2175],{"type":34,"value":2176},"0",{"type":22,"tag":60,"props":2178,"children":2179},{"style":151},[2180],{"type":34,"value":2181},"] ",{"type":22,"tag":60,"props":2183,"children":2184},{"style":145},[2185],{"type":34,"value":2166},{"type":22,"tag":60,"props":2187,"children":2188},{"style":151},[2189],{"type":34,"value":2171},{"type":22,"tag":60,"props":2191,"children":2192},{"style":241},[2193],{"type":34,"value":2176},{"type":22,"tag":60,"props":2195,"children":2196},{"style":151},[2197],{"type":34,"value":2198},"].link ",{"type":22,"tag":60,"props":2200,"children":2201},{"style":145},[2202],{"type":34,"value":1657},{"type":22,"tag":60,"props":2204,"children":2205},{"style":241},[2206],{"type":34,"value":2207}," null",{"type":22,"tag":60,"props":2209,"children":2210},{"style":151},[2211],{"type":34,"value":283},{"type":22,"tag":60,"props":2213,"children":2214},{"class":62,"line":1618},[2215],{"type":22,"tag":60,"props":2216,"children":2217},{"style":151},[2218],{"type":34,"value":2219},"            name: description.name,\n",{"type":22,"tag":60,"props":2221,"children":2222},{"class":62,"line":1626},[2223],{"type":22,"tag":60,"props":2224,"children":2225},{"style":151},[2226],{"type":34,"value":2227},"            market_hash_name: description.market_hash_name,\n",{"type":22,"tag":60,"props":2229,"children":2230},{"class":62,"line":1634},[2231],{"type":22,"tag":60,"props":2232,"children":2233},{"style":151},[2234],{"type":34,"value":2235},"            name_color: description.name_color\n",{"type":22,"tag":60,"props":2237,"children":2238},{"class":62,"line":1670},[2239],{"type":22,"tag":60,"props":2240,"children":2241},{"style":151},[2242],{"type":34,"value":2243},"        });\n",{"type":22,"tag":60,"props":2245,"children":2246},{"class":62,"line":1699},[2247],{"type":22,"tag":60,"props":2248,"children":2249},{"style":151},[2250],{"type":34,"value":1551},{"type":22,"tag":60,"props":2252,"children":2253},{"class":62,"line":1707},[2254],{"type":22,"tag":60,"props":2255,"children":2256},{"emptyLinePlaceholder":221},[2257],{"type":34,"value":224},{"type":22,"tag":60,"props":2259,"children":2260},{"class":62,"line":1715},[2261,2265],{"type":22,"tag":60,"props":2262,"children":2263},{"style":145},[2264],{"type":34,"value":1721},{"type":22,"tag":60,"props":2266,"children":2267},{"style":151},[2268],{"type":34,"value":2269}," parsedInventory;\n",{"type":22,"tag":60,"props":2271,"children":2272},{"class":62,"line":1729},[2273],{"type":22,"tag":60,"props":2274,"children":2275},{"style":151},[2276],{"type":34,"value":1262},{"type":22,"tag":23,"props":2278,"children":2279},{},[2280,2282,2288],{"type":34,"value":2281},"Some parsing is required to find the fields we are interested in (specifically the ",{"type":22,"tag":56,"props":2283,"children":2285},{"className":2284},[],[2286],{"type":34,"value":2287},"inspect_url",{"type":34,"value":2289},", which might not always be present. A sticker capsule, for instance, does not have an inspect url).",{"type":22,"tag":23,"props":2291,"children":2292},{},[2293],{"type":34,"value":2294},"If we now test running these methods using the following code:",{"type":22,"tag":49,"props":2296,"children":2298},{"code":2297,"language":1119,"meta":8,"className":1120,"style":8},"const inventory = await getUserInventory(steamid64);\nconst parsedInventory = await parseInventory(inventory);\nconsole.log(parsedInventory);\n",[2299],{"type":22,"tag":56,"props":2300,"children":2301},{"__ignoreMap":8},[2302,2331,2359],{"type":22,"tag":60,"props":2303,"children":2304},{"class":62,"line":63},[2305,2309,2314,2318,2322,2326],{"type":22,"tag":60,"props":2306,"children":2307},{"style":145},[2308],{"type":34,"value":1164},{"type":22,"tag":60,"props":2310,"children":2311},{"style":241},[2312],{"type":34,"value":2313}," inventory",{"type":22,"tag":60,"props":2315,"children":2316},{"style":145},[2317],{"type":34,"value":249},{"type":22,"tag":60,"props":2319,"children":2320},{"style":145},[2321],{"type":34,"value":1425},{"type":22,"tag":60,"props":2323,"children":2324},{"style":67},[2325],{"type":34,"value":1368},{"type":22,"tag":60,"props":2327,"children":2328},{"style":151},[2329],{"type":34,"value":2330},"(steamid64);\n",{"type":22,"tag":60,"props":2332,"children":2333},{"class":62,"line":172},[2334,2338,2342,2346,2350,2354],{"type":22,"tag":60,"props":2335,"children":2336},{"style":145},[2337],{"type":34,"value":1164},{"type":22,"tag":60,"props":2339,"children":2340},{"style":241},[2341],{"type":34,"value":1868},{"type":22,"tag":60,"props":2343,"children":2344},{"style":145},[2345],{"type":34,"value":249},{"type":22,"tag":60,"props":2347,"children":2348},{"style":145},[2349],{"type":34,"value":1425},{"type":22,"tag":60,"props":2351,"children":2352},{"style":67},[2353],{"type":34,"value":1827},{"type":22,"tag":60,"props":2355,"children":2356},{"style":151},[2357],{"type":34,"value":2358},"(inventory);\n",{"type":22,"tag":60,"props":2360,"children":2361},{"class":62,"line":198},[2362,2367,2372],{"type":22,"tag":60,"props":2363,"children":2364},{"style":151},[2365],{"type":34,"value":2366},"console.",{"type":22,"tag":60,"props":2368,"children":2369},{"style":67},[2370],{"type":34,"value":2371},"log",{"type":22,"tag":60,"props":2373,"children":2374},{"style":151},[2375],{"type":34,"value":2376},"(parsedInventory);\n",{"type":22,"tag":23,"props":2378,"children":2379},{},[2380],{"type":34,"value":2381},"We will see an array of items that look like this:",{"type":22,"tag":49,"props":2383,"children":2385},{"code":2384,"language":1119,"meta":8,"className":1120,"style":8},"{\n    appid: 730,\n    classid: '720381639',\n    instanceid: '5837227973',\n    assetid: '38537743650',\n    contextid: '2',\n    icon_url: '-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpovbSsLQJf2PLacDBA5ciJlZG0hOPxNrfunWVY7sBOguzA45W73wy2_BY4Nm32cIWQcA4_ZVCC_1K4kLvohJTt7s6YmnRqs3Yh5y7Zlgv330_d1jhnvw',\n    tradable: 1,\n    inspect_url: 'steam:\u002F\u002Frungame\u002F730\u002F76561202255233023\u002F+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D9223627464362234909',\n    name: '★ Karambit | Rust Coat',\n    market_hash_name: '★ Karambit | Rust Coat (Battle-Scarred)',\n    name_color: '8650AC'\n}\n",[2386],{"type":22,"tag":56,"props":2387,"children":2388},{"__ignoreMap":8},[2389,2397,2419,2440,2461,2482,2503,2524,2545,2566,2587,2608,2625],{"type":22,"tag":60,"props":2390,"children":2391},{"class":62,"line":63},[2392],{"type":22,"tag":60,"props":2393,"children":2394},{"style":151},[2395],{"type":34,"value":2396},"{\n",{"type":22,"tag":60,"props":2398,"children":2399},{"class":62,"line":172},[2400,2405,2410,2415],{"type":22,"tag":60,"props":2401,"children":2402},{"style":67},[2403],{"type":34,"value":2404},"    appid",{"type":22,"tag":60,"props":2406,"children":2407},{"style":151},[2408],{"type":34,"value":2409},": ",{"type":22,"tag":60,"props":2411,"children":2412},{"style":241},[2413],{"type":34,"value":2414},"730",{"type":22,"tag":60,"props":2416,"children":2417},{"style":151},[2418],{"type":34,"value":283},{"type":22,"tag":60,"props":2420,"children":2421},{"class":62,"line":198},[2422,2427,2431,2436],{"type":22,"tag":60,"props":2423,"children":2424},{"style":67},[2425],{"type":34,"value":2426},"    classid",{"type":22,"tag":60,"props":2428,"children":2429},{"style":151},[2430],{"type":34,"value":2409},{"type":22,"tag":60,"props":2432,"children":2433},{"style":73},[2434],{"type":34,"value":2435},"'720381639'",{"type":22,"tag":60,"props":2437,"children":2438},{"style":151},[2439],{"type":34,"value":283},{"type":22,"tag":60,"props":2441,"children":2442},{"class":62,"line":217},[2443,2448,2452,2457],{"type":22,"tag":60,"props":2444,"children":2445},{"style":67},[2446],{"type":34,"value":2447},"    instanceid",{"type":22,"tag":60,"props":2449,"children":2450},{"style":151},[2451],{"type":34,"value":2409},{"type":22,"tag":60,"props":2453,"children":2454},{"style":73},[2455],{"type":34,"value":2456},"'5837227973'",{"type":22,"tag":60,"props":2458,"children":2459},{"style":151},[2460],{"type":34,"value":283},{"type":22,"tag":60,"props":2462,"children":2463},{"class":62,"line":227},[2464,2469,2473,2478],{"type":22,"tag":60,"props":2465,"children":2466},{"style":67},[2467],{"type":34,"value":2468},"    assetid",{"type":22,"tag":60,"props":2470,"children":2471},{"style":151},[2472],{"type":34,"value":2409},{"type":22,"tag":60,"props":2474,"children":2475},{"style":73},[2476],{"type":34,"value":2477},"'38537743650'",{"type":22,"tag":60,"props":2479,"children":2480},{"style":151},[2481],{"type":34,"value":283},{"type":22,"tag":60,"props":2483,"children":2484},{"class":62,"line":267},[2485,2490,2494,2499],{"type":22,"tag":60,"props":2486,"children":2487},{"style":67},[2488],{"type":34,"value":2489},"    contextid",{"type":22,"tag":60,"props":2491,"children":2492},{"style":151},[2493],{"type":34,"value":2409},{"type":22,"tag":60,"props":2495,"children":2496},{"style":73},[2497],{"type":34,"value":2498},"'2'",{"type":22,"tag":60,"props":2500,"children":2501},{"style":151},[2502],{"type":34,"value":283},{"type":22,"tag":60,"props":2504,"children":2505},{"class":62,"line":286},[2506,2511,2515,2520],{"type":22,"tag":60,"props":2507,"children":2508},{"style":67},[2509],{"type":34,"value":2510},"    icon_url",{"type":22,"tag":60,"props":2512,"children":2513},{"style":151},[2514],{"type":34,"value":2409},{"type":22,"tag":60,"props":2516,"children":2517},{"style":73},[2518],{"type":34,"value":2519},"'-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpovbSsLQJf2PLacDBA5ciJlZG0hOPxNrfunWVY7sBOguzA45W73wy2_BY4Nm32cIWQcA4_ZVCC_1K4kLvohJTt7s6YmnRqs3Yh5y7Zlgv330_d1jhnvw'",{"type":22,"tag":60,"props":2521,"children":2522},{"style":151},[2523],{"type":34,"value":283},{"type":22,"tag":60,"props":2525,"children":2526},{"class":62,"line":304},[2527,2532,2536,2541],{"type":22,"tag":60,"props":2528,"children":2529},{"style":67},[2530],{"type":34,"value":2531},"    tradable",{"type":22,"tag":60,"props":2533,"children":2534},{"style":151},[2535],{"type":34,"value":2409},{"type":22,"tag":60,"props":2537,"children":2538},{"style":241},[2539],{"type":34,"value":2540},"1",{"type":22,"tag":60,"props":2542,"children":2543},{"style":151},[2544],{"type":34,"value":283},{"type":22,"tag":60,"props":2546,"children":2547},{"class":62,"line":322},[2548,2553,2557,2562],{"type":22,"tag":60,"props":2549,"children":2550},{"style":67},[2551],{"type":34,"value":2552},"    inspect_url",{"type":22,"tag":60,"props":2554,"children":2555},{"style":151},[2556],{"type":34,"value":2409},{"type":22,"tag":60,"props":2558,"children":2559},{"style":73},[2560],{"type":34,"value":2561},"'steam:\u002F\u002Frungame\u002F730\u002F76561202255233023\u002F+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D9223627464362234909'",{"type":22,"tag":60,"props":2563,"children":2564},{"style":151},[2565],{"type":34,"value":283},{"type":22,"tag":60,"props":2567,"children":2568},{"class":62,"line":340},[2569,2574,2578,2583],{"type":22,"tag":60,"props":2570,"children":2571},{"style":67},[2572],{"type":34,"value":2573},"    name",{"type":22,"tag":60,"props":2575,"children":2576},{"style":151},[2577],{"type":34,"value":2409},{"type":22,"tag":60,"props":2579,"children":2580},{"style":73},[2581],{"type":34,"value":2582},"'★ Karambit | Rust Coat'",{"type":22,"tag":60,"props":2584,"children":2585},{"style":151},[2586],{"type":34,"value":283},{"type":22,"tag":60,"props":2588,"children":2589},{"class":62,"line":379},[2590,2595,2599,2604],{"type":22,"tag":60,"props":2591,"children":2592},{"style":67},[2593],{"type":34,"value":2594},"    market_hash_name",{"type":22,"tag":60,"props":2596,"children":2597},{"style":151},[2598],{"type":34,"value":2409},{"type":22,"tag":60,"props":2600,"children":2601},{"style":73},[2602],{"type":34,"value":2603},"'★ Karambit | Rust Coat (Battle-Scarred)'",{"type":22,"tag":60,"props":2605,"children":2606},{"style":151},[2607],{"type":34,"value":283},{"type":22,"tag":60,"props":2609,"children":2610},{"class":62,"line":1297},[2611,2616,2620],{"type":22,"tag":60,"props":2612,"children":2613},{"style":67},[2614],{"type":34,"value":2615},"    name_color",{"type":22,"tag":60,"props":2617,"children":2618},{"style":151},[2619],{"type":34,"value":2409},{"type":22,"tag":60,"props":2621,"children":2622},{"style":73},[2623],{"type":34,"value":2624},"'8650AC'\n",{"type":22,"tag":60,"props":2626,"children":2627},{"class":62,"line":1326},[2628],{"type":22,"tag":60,"props":2629,"children":2630},{"style":151},[2631],{"type":34,"value":1262},{"type":22,"tag":23,"props":2633,"children":2634},{},[2635,2637,2643],{"type":34,"value":2636},"If we look at the inspect url, we can see that we are missing the S and A properties that I mentioned earlier, and that they are filled with ",{"type":22,"tag":56,"props":2638,"children":2640},{"className":2639},[],[2641],{"type":34,"value":2642},"%",{"type":34,"value":2644}," placeholders. On a positive note, at least they tell us precisely what should be put in their place.",{"type":22,"tag":1105,"props":2646,"children":2648},{"id":2647},"populating-the-owner_steamid-and-assetid-fields",[2649],{"type":34,"value":2650},"Populating the %owner_steamid% and %assetid% fields",{"type":22,"tag":23,"props":2652,"children":2653},{},[2654],{"type":34,"value":2655},"The last step is to populate the fields in the item's inspect url, and actually fetch the floatvalue for each item in the parsed inventory.",{"type":22,"tag":49,"props":2657,"children":2659},{"code":2658,"language":1119,"meta":8,"className":1120,"style":8},"\u002F**\n * Populates the float values of the items in the inventory\n * @param {ParsedInventoryItem[]} parsedInventory\n * @param {steamid64} steamid64\n * @returns {Promise\u003CParsedInventoryItem[]>}\n *\u002F\nconst addFloatsToParsedInventory = async (parsedInventory, steamid64) => {\n    const parsedInventoryWithFloats = [];\n\n    for (const item of parsedInventory) {\n        try {\n            if (!item.inspect_url) {\n                console.error('No inspect url found for item:', item.market_hash_name);\n                continue;\n            }\n\n            const parsedInspectUrl = item.inspect_url\n              .replace('%owner_steamid%', steamid64)\n              .replace('%assetid%', item.assetid);\n\n            const response = await axios.get(\n                'https:\u002F\u002Fcsinventoryapi.com\u002Fapi\u002Fv1\u002Finspect?api_key=' + API_KEY + '&url=' + parsedInspectUrl\n            );\n\n            const {\n              floatvalue,\n              paintseed,\n              paintindex\n            } = response.data.iteminfo;\n\n            parsedInventoryWithFloats.push({\n                ...item,\n                inspect_url: parsedInspectUrl,\n                floatvalue,\n                paintseed,\n                paintindex\n            });\n\n            await new Promise(r => setTimeout(r, 10000));\n            console.log('Fetched float values for item:', item.market_hash_name);\n        } catch (error) {\n            console.log(error);\n            console.error('Failed to fetch float values for item:', item.market_hash_name);\n        }\n    }\n\n    return parsedInventoryWithFloats;\n}\n",[2660],{"type":22,"tag":56,"props":2661,"children":2662},{"__ignoreMap":8},[2663,2670,2678,2699,2720,2735,2742,2792,2812,2819,2849,2861,2882,2909,2921,2929,2936,2958,2985,3010,3017,3048,3083,3091,3098,3109,3121,3133,3141,3158,3165,3181,3194,3202,3211,3220,3229,3238,3246,3297,3323,3342,3359,3384,3392,3400,3408,3421],{"type":22,"tag":60,"props":2664,"children":2665},{"class":62,"line":63},[2666],{"type":22,"tag":60,"props":2667,"children":2668},{"style":1275},[2669],{"type":34,"value":1278},{"type":22,"tag":60,"props":2671,"children":2672},{"class":62,"line":172},[2673],{"type":22,"tag":60,"props":2674,"children":2675},{"style":1275},[2676],{"type":34,"value":2677}," * Populates the float values of the items in the inventory\n",{"type":22,"tag":60,"props":2679,"children":2680},{"class":62,"line":198},[2681,2685,2689,2694],{"type":22,"tag":60,"props":2682,"children":2683},{"style":1275},[2684],{"type":34,"value":1303},{"type":22,"tag":60,"props":2686,"children":2687},{"style":145},[2688],{"type":34,"value":1308},{"type":22,"tag":60,"props":2690,"children":2691},{"style":67},[2692],{"type":34,"value":2693}," {ParsedInventoryItem[]}",{"type":22,"tag":60,"props":2695,"children":2696},{"style":151},[2697],{"type":34,"value":2698}," parsedInventory\n",{"type":22,"tag":60,"props":2700,"children":2701},{"class":62,"line":217},[2702,2706,2710,2715],{"type":22,"tag":60,"props":2703,"children":2704},{"style":1275},[2705],{"type":34,"value":1303},{"type":22,"tag":60,"props":2707,"children":2708},{"style":145},[2709],{"type":34,"value":1308},{"type":22,"tag":60,"props":2711,"children":2712},{"style":67},[2713],{"type":34,"value":2714}," {steamid64}",{"type":22,"tag":60,"props":2716,"children":2717},{"style":151},[2718],{"type":34,"value":2719}," steamid64\n",{"type":22,"tag":60,"props":2721,"children":2722},{"class":62,"line":227},[2723,2727,2731],{"type":22,"tag":60,"props":2724,"children":2725},{"style":1275},[2726],{"type":34,"value":1303},{"type":22,"tag":60,"props":2728,"children":2729},{"style":145},[2730],{"type":34,"value":1336},{"type":22,"tag":60,"props":2732,"children":2733},{"style":67},[2734],{"type":34,"value":1808},{"type":22,"tag":60,"props":2736,"children":2737},{"class":62,"line":267},[2738],{"type":22,"tag":60,"props":2739,"children":2740},{"style":1275},[2741],{"type":34,"value":1355},{"type":22,"tag":60,"props":2743,"children":2744},{"class":62,"line":286},[2745,2749,2754,2758,2762,2766,2771,2776,2780,2784,2788],{"type":22,"tag":60,"props":2746,"children":2747},{"style":145},[2748],{"type":34,"value":1164},{"type":22,"tag":60,"props":2750,"children":2751},{"style":67},[2752],{"type":34,"value":2753}," addFloatsToParsedInventory",{"type":22,"tag":60,"props":2755,"children":2756},{"style":145},[2757],{"type":34,"value":249},{"type":22,"tag":60,"props":2759,"children":2760},{"style":145},[2761],{"type":34,"value":1377},{"type":22,"tag":60,"props":2763,"children":2764},{"style":151},[2765],{"type":34,"value":1207},{"type":22,"tag":60,"props":2767,"children":2768},{"style":1384},[2769],{"type":34,"value":2770},"parsedInventory",{"type":22,"tag":60,"props":2772,"children":2773},{"style":151},[2774],{"type":34,"value":2775},", ",{"type":22,"tag":60,"props":2777,"children":2778},{"style":1384},[2779],{"type":34,"value":1387},{"type":22,"tag":60,"props":2781,"children":2782},{"style":151},[2783],{"type":34,"value":1392},{"type":22,"tag":60,"props":2785,"children":2786},{"style":145},[2787],{"type":34,"value":1397},{"type":22,"tag":60,"props":2789,"children":2790},{"style":151},[2791],{"type":34,"value":1402},{"type":22,"tag":60,"props":2793,"children":2794},{"class":62,"line":304},[2795,2799,2804,2808],{"type":22,"tag":60,"props":2796,"children":2797},{"style":145},[2798],{"type":34,"value":1411},{"type":22,"tag":60,"props":2800,"children":2801},{"style":241},[2802],{"type":34,"value":2803}," parsedInventoryWithFloats",{"type":22,"tag":60,"props":2805,"children":2806},{"style":145},[2807],{"type":34,"value":249},{"type":22,"tag":60,"props":2809,"children":2810},{"style":151},[2811],{"type":34,"value":1877},{"type":22,"tag":60,"props":2813,"children":2814},{"class":62,"line":322},[2815],{"type":22,"tag":60,"props":2816,"children":2817},{"emptyLinePlaceholder":221},[2818],{"type":34,"value":224},{"type":22,"tag":60,"props":2820,"children":2821},{"class":62,"line":340},[2822,2826,2830,2834,2839,2844],{"type":22,"tag":60,"props":2823,"children":2824},{"style":145},[2825],{"type":34,"value":1892},{"type":22,"tag":60,"props":2827,"children":2828},{"style":151},[2829],{"type":34,"value":1207},{"type":22,"tag":60,"props":2831,"children":2832},{"style":145},[2833],{"type":34,"value":1164},{"type":22,"tag":60,"props":2835,"children":2836},{"style":241},[2837],{"type":34,"value":2838}," item",{"type":22,"tag":60,"props":2840,"children":2841},{"style":145},[2842],{"type":34,"value":2843}," of",{"type":22,"tag":60,"props":2845,"children":2846},{"style":151},[2847],{"type":34,"value":2848}," parsedInventory) {\n",{"type":22,"tag":60,"props":2850,"children":2851},{"class":62,"line":379},[2852,2857],{"type":22,"tag":60,"props":2853,"children":2854},{"style":145},[2855],{"type":34,"value":2856},"        try",{"type":22,"tag":60,"props":2858,"children":2859},{"style":151},[2860],{"type":34,"value":1402},{"type":22,"tag":60,"props":2862,"children":2863},{"class":62,"line":1297},[2864,2869,2873,2877],{"type":22,"tag":60,"props":2865,"children":2866},{"style":145},[2867],{"type":34,"value":2868},"            if",{"type":22,"tag":60,"props":2870,"children":2871},{"style":151},[2872],{"type":34,"value":1207},{"type":22,"tag":60,"props":2874,"children":2875},{"style":145},[2876],{"type":34,"value":1212},{"type":22,"tag":60,"props":2878,"children":2879},{"style":151},[2880],{"type":34,"value":2881},"item.inspect_url) {\n",{"type":22,"tag":60,"props":2883,"children":2884},{"class":62,"line":1326},[2885,2890,2895,2899,2904],{"type":22,"tag":60,"props":2886,"children":2887},{"style":151},[2888],{"type":34,"value":2889},"                console.",{"type":22,"tag":60,"props":2891,"children":2892},{"style":67},[2893],{"type":34,"value":2894},"error",{"type":22,"tag":60,"props":2896,"children":2897},{"style":151},[2898],{"type":34,"value":1244},{"type":22,"tag":60,"props":2900,"children":2901},{"style":73},[2902],{"type":34,"value":2903},"'No inspect url found for item:'",{"type":22,"tag":60,"props":2905,"children":2906},{"style":151},[2907],{"type":34,"value":2908},", item.market_hash_name);\n",{"type":22,"tag":60,"props":2910,"children":2911},{"class":62,"line":1349},[2912,2917],{"type":22,"tag":60,"props":2913,"children":2914},{"style":145},[2915],{"type":34,"value":2916},"                continue",{"type":22,"tag":60,"props":2918,"children":2919},{"style":151},[2920],{"type":34,"value":169},{"type":22,"tag":60,"props":2922,"children":2923},{"class":62,"line":1358},[2924],{"type":22,"tag":60,"props":2925,"children":2926},{"style":151},[2927],{"type":34,"value":2928},"            }\n",{"type":22,"tag":60,"props":2930,"children":2931},{"class":62,"line":1405},[2932],{"type":22,"tag":60,"props":2933,"children":2934},{"emptyLinePlaceholder":221},[2935],{"type":34,"value":224},{"type":22,"tag":60,"props":2937,"children":2938},{"class":62,"line":1443},[2939,2944,2949,2953],{"type":22,"tag":60,"props":2940,"children":2941},{"style":145},[2942],{"type":34,"value":2943},"            const",{"type":22,"tag":60,"props":2945,"children":2946},{"style":241},[2947],{"type":34,"value":2948}," parsedInspectUrl",{"type":22,"tag":60,"props":2950,"children":2951},{"style":145},[2952],{"type":34,"value":249},{"type":22,"tag":60,"props":2954,"children":2955},{"style":151},[2956],{"type":34,"value":2957}," item.inspect_url\n",{"type":22,"tag":60,"props":2959,"children":2960},{"class":62,"line":1470},[2961,2966,2971,2975,2980],{"type":22,"tag":60,"props":2962,"children":2963},{"style":151},[2964],{"type":34,"value":2965},"              .",{"type":22,"tag":60,"props":2967,"children":2968},{"style":67},[2969],{"type":34,"value":2970},"replace",{"type":22,"tag":60,"props":2972,"children":2973},{"style":151},[2974],{"type":34,"value":1244},{"type":22,"tag":60,"props":2976,"children":2977},{"style":73},[2978],{"type":34,"value":2979},"'%owner_steamid%'",{"type":22,"tag":60,"props":2981,"children":2982},{"style":151},[2983],{"type":34,"value":2984},", steamid64)\n",{"type":22,"tag":60,"props":2986,"children":2987},{"class":62,"line":1479},[2988,2992,2996,3000,3005],{"type":22,"tag":60,"props":2989,"children":2990},{"style":151},[2991],{"type":34,"value":2965},{"type":22,"tag":60,"props":2993,"children":2994},{"style":67},[2995],{"type":34,"value":2970},{"type":22,"tag":60,"props":2997,"children":2998},{"style":151},[2999],{"type":34,"value":1244},{"type":22,"tag":60,"props":3001,"children":3002},{"style":73},[3003],{"type":34,"value":3004},"'%assetid%'",{"type":22,"tag":60,"props":3006,"children":3007},{"style":151},[3008],{"type":34,"value":3009},", item.assetid);\n",{"type":22,"tag":60,"props":3011,"children":3012},{"class":62,"line":1487},[3013],{"type":22,"tag":60,"props":3014,"children":3015},{"emptyLinePlaceholder":221},[3016],{"type":34,"value":224},{"type":22,"tag":60,"props":3018,"children":3019},{"class":62,"line":1515},[3020,3024,3028,3032,3036,3040,3044],{"type":22,"tag":60,"props":3021,"children":3022},{"style":145},[3023],{"type":34,"value":2943},{"type":22,"tag":60,"props":3025,"children":3026},{"style":241},[3027],{"type":34,"value":1416},{"type":22,"tag":60,"props":3029,"children":3030},{"style":145},[3031],{"type":34,"value":249},{"type":22,"tag":60,"props":3033,"children":3034},{"style":145},[3035],{"type":34,"value":1425},{"type":22,"tag":60,"props":3037,"children":3038},{"style":151},[3039],{"type":34,"value":1430},{"type":22,"tag":60,"props":3041,"children":3042},{"style":67},[3043],{"type":34,"value":1435},{"type":22,"tag":60,"props":3045,"children":3046},{"style":151},[3047],{"type":34,"value":1440},{"type":22,"tag":60,"props":3049,"children":3050},{"class":62,"line":1545},[3051,3056,3061,3065,3069,3074,3078],{"type":22,"tag":60,"props":3052,"children":3053},{"style":73},[3054],{"type":34,"value":3055},"                'https:\u002F\u002Fcsinventoryapi.com\u002Fapi\u002Fv1\u002Finspect?api_key='",{"type":22,"tag":60,"props":3057,"children":3058},{"style":145},[3059],{"type":34,"value":3060}," +",{"type":22,"tag":60,"props":3062,"children":3063},{"style":241},[3064],{"type":34,"value":1169},{"type":22,"tag":60,"props":3066,"children":3067},{"style":145},[3068],{"type":34,"value":3060},{"type":22,"tag":60,"props":3070,"children":3071},{"style":73},[3072],{"type":34,"value":3073}," '&url='",{"type":22,"tag":60,"props":3075,"children":3076},{"style":145},[3077],{"type":34,"value":3060},{"type":22,"tag":60,"props":3079,"children":3080},{"style":151},[3081],{"type":34,"value":3082}," parsedInspectUrl\n",{"type":22,"tag":60,"props":3084,"children":3085},{"class":62,"line":1554},[3086],{"type":22,"tag":60,"props":3087,"children":3088},{"style":151},[3089],{"type":34,"value":3090},"            );\n",{"type":22,"tag":60,"props":3092,"children":3093},{"class":62,"line":1562},[3094],{"type":22,"tag":60,"props":3095,"children":3096},{"emptyLinePlaceholder":221},[3097],{"type":34,"value":224},{"type":22,"tag":60,"props":3099,"children":3100},{"class":62,"line":1589},[3101,3105],{"type":22,"tag":60,"props":3102,"children":3103},{"style":145},[3104],{"type":34,"value":2943},{"type":22,"tag":60,"props":3106,"children":3107},{"style":151},[3108],{"type":34,"value":1402},{"type":22,"tag":60,"props":3110,"children":3111},{"class":62,"line":1618},[3112,3117],{"type":22,"tag":60,"props":3113,"children":3114},{"style":241},[3115],{"type":34,"value":3116},"              floatvalue",{"type":22,"tag":60,"props":3118,"children":3119},{"style":151},[3120],{"type":34,"value":283},{"type":22,"tag":60,"props":3122,"children":3123},{"class":62,"line":1626},[3124,3129],{"type":22,"tag":60,"props":3125,"children":3126},{"style":241},[3127],{"type":34,"value":3128},"              paintseed",{"type":22,"tag":60,"props":3130,"children":3131},{"style":151},[3132],{"type":34,"value":283},{"type":22,"tag":60,"props":3134,"children":3135},{"class":62,"line":1634},[3136],{"type":22,"tag":60,"props":3137,"children":3138},{"style":241},[3139],{"type":34,"value":3140},"              paintindex\n",{"type":22,"tag":60,"props":3142,"children":3143},{"class":62,"line":1670},[3144,3149,3153],{"type":22,"tag":60,"props":3145,"children":3146},{"style":151},[3147],{"type":34,"value":3148},"            } ",{"type":22,"tag":60,"props":3150,"children":3151},{"style":145},[3152],{"type":34,"value":1911},{"type":22,"tag":60,"props":3154,"children":3155},{"style":151},[3156],{"type":34,"value":3157}," response.data.iteminfo;\n",{"type":22,"tag":60,"props":3159,"children":3160},{"class":62,"line":1699},[3161],{"type":22,"tag":60,"props":3162,"children":3163},{"emptyLinePlaceholder":221},[3164],{"type":34,"value":224},{"type":22,"tag":60,"props":3166,"children":3167},{"class":62,"line":1707},[3168,3173,3177],{"type":22,"tag":60,"props":3169,"children":3170},{"style":151},[3171],{"type":34,"value":3172},"            parsedInventoryWithFloats.",{"type":22,"tag":60,"props":3174,"children":3175},{"style":67},[3176],{"type":34,"value":2093},{"type":22,"tag":60,"props":3178,"children":3179},{"style":151},[3180],{"type":34,"value":264},{"type":22,"tag":60,"props":3182,"children":3183},{"class":62,"line":1715},[3184,3189],{"type":22,"tag":60,"props":3185,"children":3186},{"style":145},[3187],{"type":34,"value":3188},"                ...",{"type":22,"tag":60,"props":3190,"children":3191},{"style":151},[3192],{"type":34,"value":3193},"item,\n",{"type":22,"tag":60,"props":3195,"children":3196},{"class":62,"line":1729},[3197],{"type":22,"tag":60,"props":3198,"children":3199},{"style":151},[3200],{"type":34,"value":3201},"                inspect_url: parsedInspectUrl,\n",{"type":22,"tag":60,"props":3203,"children":3205},{"class":62,"line":3204},34,[3206],{"type":22,"tag":60,"props":3207,"children":3208},{"style":151},[3209],{"type":34,"value":3210},"                floatvalue,\n",{"type":22,"tag":60,"props":3212,"children":3214},{"class":62,"line":3213},35,[3215],{"type":22,"tag":60,"props":3216,"children":3217},{"style":151},[3218],{"type":34,"value":3219},"                paintseed,\n",{"type":22,"tag":60,"props":3221,"children":3223},{"class":62,"line":3222},36,[3224],{"type":22,"tag":60,"props":3225,"children":3226},{"style":151},[3227],{"type":34,"value":3228},"                paintindex\n",{"type":22,"tag":60,"props":3230,"children":3232},{"class":62,"line":3231},37,[3233],{"type":22,"tag":60,"props":3234,"children":3235},{"style":151},[3236],{"type":34,"value":3237},"            });\n",{"type":22,"tag":60,"props":3239,"children":3241},{"class":62,"line":3240},38,[3242],{"type":22,"tag":60,"props":3243,"children":3244},{"emptyLinePlaceholder":221},[3245],{"type":34,"value":224},{"type":22,"tag":60,"props":3247,"children":3249},{"class":62,"line":3248},39,[3250,3255,3259,3264,3268,3273,3277,3282,3287,3292],{"type":22,"tag":60,"props":3251,"children":3252},{"style":145},[3253],{"type":34,"value":3254},"            await",{"type":22,"tag":60,"props":3256,"children":3257},{"style":145},[3258],{"type":34,"value":254},{"type":22,"tag":60,"props":3260,"children":3261},{"style":241},[3262],{"type":34,"value":3263}," Promise",{"type":22,"tag":60,"props":3265,"children":3266},{"style":151},[3267],{"type":34,"value":1244},{"type":22,"tag":60,"props":3269,"children":3270},{"style":1384},[3271],{"type":34,"value":3272},"r",{"type":22,"tag":60,"props":3274,"children":3275},{"style":145},[3276],{"type":34,"value":2011},{"type":22,"tag":60,"props":3278,"children":3279},{"style":67},[3280],{"type":34,"value":3281}," setTimeout",{"type":22,"tag":60,"props":3283,"children":3284},{"style":151},[3285],{"type":34,"value":3286},"(r, ",{"type":22,"tag":60,"props":3288,"children":3289},{"style":241},[3290],{"type":34,"value":3291},"10000",{"type":22,"tag":60,"props":3293,"children":3294},{"style":151},[3295],{"type":34,"value":3296},"));\n",{"type":22,"tag":60,"props":3298,"children":3300},{"class":62,"line":3299},40,[3301,3306,3310,3314,3319],{"type":22,"tag":60,"props":3302,"children":3303},{"style":151},[3304],{"type":34,"value":3305},"            console.",{"type":22,"tag":60,"props":3307,"children":3308},{"style":67},[3309],{"type":34,"value":2371},{"type":22,"tag":60,"props":3311,"children":3312},{"style":151},[3313],{"type":34,"value":1244},{"type":22,"tag":60,"props":3315,"children":3316},{"style":73},[3317],{"type":34,"value":3318},"'Fetched float values for item:'",{"type":22,"tag":60,"props":3320,"children":3321},{"style":151},[3322],{"type":34,"value":2908},{"type":22,"tag":60,"props":3324,"children":3326},{"class":62,"line":3325},41,[3327,3332,3337],{"type":22,"tag":60,"props":3328,"children":3329},{"style":151},[3330],{"type":34,"value":3331},"        } ",{"type":22,"tag":60,"props":3333,"children":3334},{"style":145},[3335],{"type":34,"value":3336},"catch",{"type":22,"tag":60,"props":3338,"children":3339},{"style":151},[3340],{"type":34,"value":3341}," (error) {\n",{"type":22,"tag":60,"props":3343,"children":3345},{"class":62,"line":3344},42,[3346,3350,3354],{"type":22,"tag":60,"props":3347,"children":3348},{"style":151},[3349],{"type":34,"value":3305},{"type":22,"tag":60,"props":3351,"children":3352},{"style":67},[3353],{"type":34,"value":2371},{"type":22,"tag":60,"props":3355,"children":3356},{"style":151},[3357],{"type":34,"value":3358},"(error);\n",{"type":22,"tag":60,"props":3360,"children":3362},{"class":62,"line":3361},43,[3363,3367,3371,3375,3380],{"type":22,"tag":60,"props":3364,"children":3365},{"style":151},[3366],{"type":34,"value":3305},{"type":22,"tag":60,"props":3368,"children":3369},{"style":67},[3370],{"type":34,"value":2894},{"type":22,"tag":60,"props":3372,"children":3373},{"style":151},[3374],{"type":34,"value":1244},{"type":22,"tag":60,"props":3376,"children":3377},{"style":73},[3378],{"type":34,"value":3379},"'Failed to fetch float values for item:'",{"type":22,"tag":60,"props":3381,"children":3382},{"style":151},[3383],{"type":34,"value":2908},{"type":22,"tag":60,"props":3385,"children":3387},{"class":62,"line":3386},44,[3388],{"type":22,"tag":60,"props":3389,"children":3390},{"style":151},[3391],{"type":34,"value":2073},{"type":22,"tag":60,"props":3393,"children":3395},{"class":62,"line":3394},45,[3396],{"type":22,"tag":60,"props":3397,"children":3398},{"style":151},[3399],{"type":34,"value":1551},{"type":22,"tag":60,"props":3401,"children":3403},{"class":62,"line":3402},46,[3404],{"type":22,"tag":60,"props":3405,"children":3406},{"emptyLinePlaceholder":221},[3407],{"type":34,"value":224},{"type":22,"tag":60,"props":3409,"children":3411},{"class":62,"line":3410},47,[3412,3416],{"type":22,"tag":60,"props":3413,"children":3414},{"style":145},[3415],{"type":34,"value":1721},{"type":22,"tag":60,"props":3417,"children":3418},{"style":151},[3419],{"type":34,"value":3420}," parsedInventoryWithFloats;\n",{"type":22,"tag":60,"props":3422,"children":3424},{"class":62,"line":3423},48,[3425],{"type":22,"tag":60,"props":3426,"children":3427},{"style":151},[3428],{"type":34,"value":1262},{"type":22,"tag":23,"props":3430,"children":3431},{},[3432,3434,3439],{"type":34,"value":3433},"First we replace the missing fields in the ",{"type":22,"tag":56,"props":3435,"children":3437},{"className":3436},[],[3438],{"type":34,"value":2287},{"type":34,"value":3440},", then we fetch the floatvalue using the API endpoint.",{"type":22,"tag":23,"props":3442,"children":3443},{},[3444],{"type":34,"value":3445},"If we run this and print the inventory afterwards, we'll see floatvalues for the items that have that property, e.g.:",{"type":22,"tag":49,"props":3447,"children":3449},{"code":3448,"language":1119,"meta":8,"className":1120,"style":8},"{\n    appid: 730,\n    classid: '1310017306',\n    instanceid: '5844343608',\n    assetid: '28124449669',\n    contextid: '2',\n    icon_url: '-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpoo6m1FBRp3_bGcjhQ09-jq5WYh8j_OrfdqWhe5sN4mOTE8bP5gVO8v106NT37LY-cJAZvZF-ErAC7wLi60MO57s7NwSBgvSgksynamEfmiRBJcKUx0nUflmj0',\n    tradable: 1,\n    inspect_url: 'steam:\u002F\u002Frungame\u002F730\u002F76561202255233023\u002F+csgo_econ_action_preview%20S76561198166295458A28124449669D17212839835523578275',\n    name: 'USP-S | Kill Confirmed',\n    market_hash_name: 'USP-S | Kill Confirmed (Minimal Wear)',\n    name_color: 'D2D2D2',\n    floatvalue: 0.13473990559577942,\n    paintseed: 461,\n    paintindex: 504\n}\n",[3450],{"type":22,"tag":56,"props":3451,"children":3452},{"__ignoreMap":8},[3453,3460,3479,3499,3519,3539,3558,3578,3597,3617,3637,3657,3677,3698,3719,3736],{"type":22,"tag":60,"props":3454,"children":3455},{"class":62,"line":63},[3456],{"type":22,"tag":60,"props":3457,"children":3458},{"style":151},[3459],{"type":34,"value":2396},{"type":22,"tag":60,"props":3461,"children":3462},{"class":62,"line":172},[3463,3467,3471,3475],{"type":22,"tag":60,"props":3464,"children":3465},{"style":67},[3466],{"type":34,"value":2404},{"type":22,"tag":60,"props":3468,"children":3469},{"style":151},[3470],{"type":34,"value":2409},{"type":22,"tag":60,"props":3472,"children":3473},{"style":241},[3474],{"type":34,"value":2414},{"type":22,"tag":60,"props":3476,"children":3477},{"style":151},[3478],{"type":34,"value":283},{"type":22,"tag":60,"props":3480,"children":3481},{"class":62,"line":198},[3482,3486,3490,3495],{"type":22,"tag":60,"props":3483,"children":3484},{"style":67},[3485],{"type":34,"value":2426},{"type":22,"tag":60,"props":3487,"children":3488},{"style":151},[3489],{"type":34,"value":2409},{"type":22,"tag":60,"props":3491,"children":3492},{"style":73},[3493],{"type":34,"value":3494},"'1310017306'",{"type":22,"tag":60,"props":3496,"children":3497},{"style":151},[3498],{"type":34,"value":283},{"type":22,"tag":60,"props":3500,"children":3501},{"class":62,"line":217},[3502,3506,3510,3515],{"type":22,"tag":60,"props":3503,"children":3504},{"style":67},[3505],{"type":34,"value":2447},{"type":22,"tag":60,"props":3507,"children":3508},{"style":151},[3509],{"type":34,"value":2409},{"type":22,"tag":60,"props":3511,"children":3512},{"style":73},[3513],{"type":34,"value":3514},"'5844343608'",{"type":22,"tag":60,"props":3516,"children":3517},{"style":151},[3518],{"type":34,"value":283},{"type":22,"tag":60,"props":3520,"children":3521},{"class":62,"line":227},[3522,3526,3530,3535],{"type":22,"tag":60,"props":3523,"children":3524},{"style":67},[3525],{"type":34,"value":2468},{"type":22,"tag":60,"props":3527,"children":3528},{"style":151},[3529],{"type":34,"value":2409},{"type":22,"tag":60,"props":3531,"children":3532},{"style":73},[3533],{"type":34,"value":3534},"'28124449669'",{"type":22,"tag":60,"props":3536,"children":3537},{"style":151},[3538],{"type":34,"value":283},{"type":22,"tag":60,"props":3540,"children":3541},{"class":62,"line":267},[3542,3546,3550,3554],{"type":22,"tag":60,"props":3543,"children":3544},{"style":67},[3545],{"type":34,"value":2489},{"type":22,"tag":60,"props":3547,"children":3548},{"style":151},[3549],{"type":34,"value":2409},{"type":22,"tag":60,"props":3551,"children":3552},{"style":73},[3553],{"type":34,"value":2498},{"type":22,"tag":60,"props":3555,"children":3556},{"style":151},[3557],{"type":34,"value":283},{"type":22,"tag":60,"props":3559,"children":3560},{"class":62,"line":286},[3561,3565,3569,3574],{"type":22,"tag":60,"props":3562,"children":3563},{"style":67},[3564],{"type":34,"value":2510},{"type":22,"tag":60,"props":3566,"children":3567},{"style":151},[3568],{"type":34,"value":2409},{"type":22,"tag":60,"props":3570,"children":3571},{"style":73},[3572],{"type":34,"value":3573},"'-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpoo6m1FBRp3_bGcjhQ09-jq5WYh8j_OrfdqWhe5sN4mOTE8bP5gVO8v106NT37LY-cJAZvZF-ErAC7wLi60MO57s7NwSBgvSgksynamEfmiRBJcKUx0nUflmj0'",{"type":22,"tag":60,"props":3575,"children":3576},{"style":151},[3577],{"type":34,"value":283},{"type":22,"tag":60,"props":3579,"children":3580},{"class":62,"line":304},[3581,3585,3589,3593],{"type":22,"tag":60,"props":3582,"children":3583},{"style":67},[3584],{"type":34,"value":2531},{"type":22,"tag":60,"props":3586,"children":3587},{"style":151},[3588],{"type":34,"value":2409},{"type":22,"tag":60,"props":3590,"children":3591},{"style":241},[3592],{"type":34,"value":2540},{"type":22,"tag":60,"props":3594,"children":3595},{"style":151},[3596],{"type":34,"value":283},{"type":22,"tag":60,"props":3598,"children":3599},{"class":62,"line":322},[3600,3604,3608,3613],{"type":22,"tag":60,"props":3601,"children":3602},{"style":67},[3603],{"type":34,"value":2552},{"type":22,"tag":60,"props":3605,"children":3606},{"style":151},[3607],{"type":34,"value":2409},{"type":22,"tag":60,"props":3609,"children":3610},{"style":73},[3611],{"type":34,"value":3612},"'steam:\u002F\u002Frungame\u002F730\u002F76561202255233023\u002F+csgo_econ_action_preview%20S76561198166295458A28124449669D17212839835523578275'",{"type":22,"tag":60,"props":3614,"children":3615},{"style":151},[3616],{"type":34,"value":283},{"type":22,"tag":60,"props":3618,"children":3619},{"class":62,"line":340},[3620,3624,3628,3633],{"type":22,"tag":60,"props":3621,"children":3622},{"style":67},[3623],{"type":34,"value":2573},{"type":22,"tag":60,"props":3625,"children":3626},{"style":151},[3627],{"type":34,"value":2409},{"type":22,"tag":60,"props":3629,"children":3630},{"style":73},[3631],{"type":34,"value":3632},"'USP-S | Kill Confirmed'",{"type":22,"tag":60,"props":3634,"children":3635},{"style":151},[3636],{"type":34,"value":283},{"type":22,"tag":60,"props":3638,"children":3639},{"class":62,"line":379},[3640,3644,3648,3653],{"type":22,"tag":60,"props":3641,"children":3642},{"style":67},[3643],{"type":34,"value":2594},{"type":22,"tag":60,"props":3645,"children":3646},{"style":151},[3647],{"type":34,"value":2409},{"type":22,"tag":60,"props":3649,"children":3650},{"style":73},[3651],{"type":34,"value":3652},"'USP-S | Kill Confirmed (Minimal Wear)'",{"type":22,"tag":60,"props":3654,"children":3655},{"style":151},[3656],{"type":34,"value":283},{"type":22,"tag":60,"props":3658,"children":3659},{"class":62,"line":1297},[3660,3664,3668,3673],{"type":22,"tag":60,"props":3661,"children":3662},{"style":67},[3663],{"type":34,"value":2615},{"type":22,"tag":60,"props":3665,"children":3666},{"style":151},[3667],{"type":34,"value":2409},{"type":22,"tag":60,"props":3669,"children":3670},{"style":73},[3671],{"type":34,"value":3672},"'D2D2D2'",{"type":22,"tag":60,"props":3674,"children":3675},{"style":151},[3676],{"type":34,"value":283},{"type":22,"tag":60,"props":3678,"children":3679},{"class":62,"line":1326},[3680,3685,3689,3694],{"type":22,"tag":60,"props":3681,"children":3682},{"style":67},[3683],{"type":34,"value":3684},"    floatvalue",{"type":22,"tag":60,"props":3686,"children":3687},{"style":151},[3688],{"type":34,"value":2409},{"type":22,"tag":60,"props":3690,"children":3691},{"style":241},[3692],{"type":34,"value":3693},"0.13473990559577942",{"type":22,"tag":60,"props":3695,"children":3696},{"style":151},[3697],{"type":34,"value":283},{"type":22,"tag":60,"props":3699,"children":3700},{"class":62,"line":1349},[3701,3706,3710,3715],{"type":22,"tag":60,"props":3702,"children":3703},{"style":67},[3704],{"type":34,"value":3705},"    paintseed",{"type":22,"tag":60,"props":3707,"children":3708},{"style":151},[3709],{"type":34,"value":2409},{"type":22,"tag":60,"props":3711,"children":3712},{"style":241},[3713],{"type":34,"value":3714},"461",{"type":22,"tag":60,"props":3716,"children":3717},{"style":151},[3718],{"type":34,"value":283},{"type":22,"tag":60,"props":3720,"children":3721},{"class":62,"line":1358},[3722,3727,3731],{"type":22,"tag":60,"props":3723,"children":3724},{"style":67},[3725],{"type":34,"value":3726},"    paintindex",{"type":22,"tag":60,"props":3728,"children":3729},{"style":151},[3730],{"type":34,"value":2409},{"type":22,"tag":60,"props":3732,"children":3733},{"style":241},[3734],{"type":34,"value":3735},"504\n",{"type":22,"tag":60,"props":3737,"children":3738},{"class":62,"line":1405},[3739],{"type":22,"tag":60,"props":3740,"children":3741},{"style":151},[3742],{"type":34,"value":1262},{"type":22,"tag":37,"props":3744,"children":3746},{"id":3745},"a-note-on-rate-limits",[3747],{"type":34,"value":3748},"A note on rate limits",{"type":22,"tag":23,"props":3750,"children":3751},{},[3752],{"type":34,"value":3753},"The timeout in the loop is to make sure that you do not hit the rate limit imposed by CSInventoryAPI. If you have a business\u002Fenterprise plan, the timeout duration can be adjusted accordingly.",{"type":22,"tag":23,"props":3755,"children":3756},{},[3757,3759,3765],{"type":34,"value":3758},"If you have any questions, want further help with implementation, or want to start a new project, feel free to ",{"type":22,"tag":882,"props":3760,"children":3762},{"href":3761},"\u002Fcontact",[3763],{"type":34,"value":3764},"get in touch",{"type":34,"value":1037},{"type":22,"tag":835,"props":3767,"children":3768},{},[3769],{"type":34,"value":839},{"title":8,"searchDepth":172,"depth":172,"links":3771},[3772,3773,3774,3779],{"id":914,"depth":172,"text":917},{"id":1021,"depth":172,"text":1024},{"id":1073,"depth":172,"text":1076,"children":3775},[3776,3777,3778],{"id":1107,"depth":198,"text":1110},{"id":1742,"depth":198,"text":1745},{"id":2647,"depth":198,"text":2650},{"id":3745,"depth":172,"text":3748},"content:articles:cs2-inventory-with-floats-using-csinventoryapi-nodejs.md","articles\u002Fcs2-inventory-with-floats-using-csinventoryapi-nodejs.md","articles\u002Fcs2-inventory-with-floats-using-csinventoryapi-nodejs",{"_path":3784,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":3785,"description":3786,"date":3787,"image":3788,"tags":3789,"body":3791,"_type":846,"_id":4158,"_source":848,"_file":4159,"_stem":4160,"_extension":851},"\u002Farticles\u002Fsteam-desktop-authenticator","Step-by-Step Guide to Setting Up Steam Desktop Authenticator for a Steam Bot","Step by step guide to set up Steam Desktop Authenticator required to build Steam bots with automated trading capabilities, updated for 2024.","2024-03-27","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002FSTEAM-DESKTOP-AUTHENTICATOR.jpg",[859,3790,17],"Trading",{"type":19,"children":3792,"toc":4148},[3793,3799,3813,3819,3841,3846,3852,3857,3871,3879,3885,3890,3898,3903,3911,3917,3922,3930,3936,3941,3949,3955,3960,3968,3974,3993,3998,4006,4027,4032,4075,4080,4085,4109,4114,4120,4134,4144],{"type":22,"tag":23,"props":3794,"children":3795},{},[3796],{"type":22,"tag":27,"props":3797,"children":3798},{"alt":3785,"src":3788},[],{"type":22,"tag":23,"props":3800,"children":3801},{},[3802,3804,3811],{"type":34,"value":3803},"When building an application utilizing a Steam Bot, e.g., trading applications or gambling websites not using peer-to-peer trading for deposits\u002Fwithdraws, you will need dedicated Steam accounts that will be used for this purpose. These accounts, which will have their trading and therefore confirmation of trades automated, must still have a mobile authenticator set up to avoid delays with their trading. Seeing as setting up a mobile authenticator on your phone hides away some files you need to access to set the bots up for trading, a program called ",{"type":22,"tag":882,"props":3805,"children":3808},{"href":3806,"rel":3807},"https:\u002F\u002Fgithub.com\u002FJessecar96\u002FSteamDesktopAuthenticator",[886],[3809],{"type":34,"value":3810},"Steam Desktop Authenticator",{"type":34,"value":3812}," is commonly used for this purpose.",{"type":22,"tag":37,"props":3814,"children":3816},{"id":3815},"prerequisites",[3817],{"type":34,"value":3818},"Prerequisites",{"type":22,"tag":23,"props":3820,"children":3821},{},[3822,3824,3831,3833,3839],{"type":34,"value":3823},"Firstly, you will already need a Steam account. Seeing as the registration process is relatively straightforward, I will not be addressing this in the article. I typically use a ",{"type":22,"tag":882,"props":3825,"children":3828},{"href":3826,"rel":3827},"https:\u002F\u002Fproton.me\u002Fmail",[886],[3829],{"type":34,"value":3830},"Proton",{"type":34,"value":3832}," email address (remember to verify it with a real email to not lock your inbox). Furthermore, if the intention is to trade with the account, it might be a good idea to add $5 to the account balance to remove its restriction. I do a more detailed walkthrough of this in my guide on ",{"type":22,"tag":882,"props":3834,"children":3836},{"href":3835},"\u002Farticles\u002Fhow-to-obtain-your-steam-api-key",[3837],{"type":34,"value":3838},"adding a Steam Web API key",{"type":34,"value":3840}," to a Steam account (something that you should also do for your bot account after we are done setting up Steam Desktop Authenticator).",{"type":22,"tag":23,"props":3842,"children":3843},{},[3844],{"type":34,"value":3845},"Since the application is Windows only, you'll also need either a computer running Windows, or run it in a VM. I went with the first option, but whatever floats the boat for you works.",{"type":22,"tag":37,"props":3847,"children":3849},{"id":3848},"step-1-download-the-legit-version-of-steam-desktop-authenticator",[3850],{"type":34,"value":3851},"Step 1 — Download the legit version of Steam Desktop Authenticator",{"type":22,"tag":23,"props":3853,"children":3854},{},[3855],{"type":34,"value":3856},"Seeing as Steam Desktop Authenticator handles incredibly sensitive data which potentially allows a malicious actor to automatically send trades on your account's behalf, there are several phishing sites and actors that try to get you to download a \"fake\" version of Steam Desktop Authenticator, to access your Steam account's credentials and probably empty the inventory.",{"type":22,"tag":23,"props":3858,"children":3859},{},[3860,3862,3869],{"type":34,"value":3861},"As such, this is the only legit link to the official GitHub repo maintained by Jessecar96 (the creator of the program). We are going to download the ",{"type":22,"tag":882,"props":3863,"children":3866},{"href":3864,"rel":3865},"https:\u002F\u002Fgithub.com\u002FJessecar96\u002FSteamDesktopAuthenticator\u002Freleases\u002Ftag\u002F1.0.15",[886],[3867],{"type":34,"value":3868},"1.0.15 version",{"type":34,"value":3870},". Click and download the according zip file:",{"type":22,"tag":23,"props":3872,"children":3873},{},[3874],{"type":22,"tag":27,"props":3875,"children":3878},{"alt":3876,"src":3877},"Download Steam Desktop Authenticator 1.0.15 from GitHub","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Fdownload-release.png",[],{"type":22,"tag":37,"props":3880,"children":3882},{"id":3881},"step-2-add-the-bot-account",[3883],{"type":34,"value":3884},"Step 2 — Add the bot account",{"type":22,"tag":23,"props":3886,"children":3887},{},[3888],{"type":34,"value":3889},"After downloading and unzipping the folder, it's time to start the Steam Desktop Authenticator by clicking the \"Steam Desktop Authenticator.exe\" file. Assuming it is your first time using the application to set up a SteamBot, click \"This is my first time and I just want to sign into my Steam Account(s)\" when prompted:",{"type":22,"tag":23,"props":3891,"children":3892},{},[3893],{"type":22,"tag":27,"props":3894,"children":3897},{"alt":3895,"src":3896},"First-time Steam Desktop Authenticator setup prompt","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Ffirst-prompt.png",[],{"type":22,"tag":23,"props":3899,"children":3900},{},[3901],{"type":34,"value":3902},"Afterward, the application will open, whereupon you will press \"Setup New Account\" in the top left corner. When prompted to enter login details, enter the username and password of the Steam account that you wish to use as a SteamBot.",{"type":22,"tag":23,"props":3904,"children":3905},{},[3906],{"type":22,"tag":27,"props":3907,"children":3910},{"alt":3908,"src":3909},"Sign in to the bot Steam account in Steam Desktop Authenticator","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Fsign-in.png",[],{"type":22,"tag":37,"props":3912,"children":3914},{"id":3913},"step-3-save-the-revocation-code",[3915],{"type":34,"value":3916},"Step 3 — Save the revocation code",{"type":22,"tag":23,"props":3918,"children":3919},{},[3920],{"type":34,"value":3921},"After signing in, you will be prompted to save your revocation code. This is crucial if someone ever obtains unauthorized access to your Steam account (the risk of which is increased substantially by using it as a SteamBot with sign-in details used in the operation of a web application). You will be prompted to re-enter the revocation code too, to ensure that it has been written down correctly.",{"type":22,"tag":23,"props":3923,"children":3924},{},[3925],{"type":22,"tag":27,"props":3926,"children":3929},{"alt":3927,"src":3928},"Save and confirm the Steam revocation code","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Frevoke.png",[],{"type":22,"tag":37,"props":3931,"children":3933},{"id":3932},"step-4-sms-code-sent-to-your-phone-email-actually",[3934],{"type":34,"value":3935},"Step 4 — SMS code sent to your \"phone\" (email actually)",{"type":22,"tag":23,"props":3937,"children":3938},{},[3939],{"type":34,"value":3940},"Even though Steam Desktop Authenticator asks you to enter the code sent via SMS, the code is sent to your email. This is a relic from past versions of the applications where a phone number was required to set up the mobile authenticator, which curiously is not the case anymore. The email should look something like this:",{"type":22,"tag":23,"props":3942,"children":3943},{},[3944],{"type":22,"tag":27,"props":3945,"children":3948},{"alt":3946,"src":3947},"Authenticator setup code email from Steam","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Fsms-email.png",[],{"type":22,"tag":37,"props":3950,"children":3952},{"id":3951},"step-5-re-enter-revocation-code",[3953],{"type":34,"value":3954},"Step 5 — Re-enter revocation code",{"type":22,"tag":23,"props":3956,"children":3957},{},[3958],{"type":34,"value":3959},"As a last step of the setup process, you will be asked to enter the revocation code as specified in Step 3. As mentioned before, this is to ensure that you wrote it down, as it is in your best interest to have this information if you ever need support to get your account back from a malicious actor.",{"type":22,"tag":23,"props":3961,"children":3962},{},[3963],{"type":22,"tag":27,"props":3964,"children":3967},{"alt":3965,"src":3966},"Re-enter the revocation code to finish setup","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Frevokeagain.png",[],{"type":22,"tag":37,"props":3969,"children":3971},{"id":3970},"step-6-write-down-mafile-information",[3972],{"type":34,"value":3973},"Step 6 — Write down .maFile information",{"type":22,"tag":23,"props":3975,"children":3976},{},[3977,3979,3984,3986,3991],{"type":34,"value":3978},"There we go! Now, with a mobile authenticator set up, we can obtain the information we need to automate trading with the SteamBots through code. The fields we are looking for are called ",{"type":22,"tag":924,"props":3980,"children":3981},{},[3982],{"type":34,"value":3983},"sharedSecret",{"type":34,"value":3985}," (used for automatically generating the 2FA code required to sign in) and ",{"type":22,"tag":924,"props":3987,"children":3988},{},[3989],{"type":34,"value":3990},"identitySecret",{"type":34,"value":3992}," (used to automate confirmation of trades where the bot has items to give).",{"type":22,"tag":23,"props":3994,"children":3995},{},[3996],{"type":34,"value":3997},"To find said properties, you need to navigate to the folder holding all Steam Desktop Authenticator files and navigate to the maFiles subfolder:",{"type":22,"tag":23,"props":3999,"children":4000},{},[4001],{"type":22,"tag":27,"props":4002,"children":4005},{"alt":4003,"src":4004},"maFiles folder containing Steam Desktop Authenticator account files","\u002Fimg\u002Farticles\u002Fsteam-desktop-authenticator\u002Fmafiles.png",[],{"type":22,"tag":23,"props":4007,"children":4008},{},[4009,4011,4017,4019,4025],{"type":34,"value":4010},"If you have multiple accounts (like is the case here), the format is ",{"type":22,"tag":56,"props":4012,"children":4014},{"className":4013},[],[4015],{"type":34,"value":4016},"{BOT_STEAMID64}.maFile",{"type":34,"value":4018},", so go ahead and open the one that's relevant for the bot account you are setting up right now. Use ",{"type":22,"tag":882,"props":4020,"children":4023},{"href":4021,"rel":4022},"https:\u002F\u002Fsteamid.io",[886],[4024],{"type":34,"value":4021},{"type":34,"value":4026}," if you need to obtain the account's SteamID64.",{"type":22,"tag":23,"props":4028,"children":4029},{},[4030],{"type":34,"value":4031},"Opening the file, it should start with:",{"type":22,"tag":49,"props":4033,"children":4037},{"className":4034,"code":4035,"language":4036,"meta":8,"style":8},"language-json shiki shiki-themes github-dark","{\"shared_secret\":\"XXXX\",...\n","json",[4038],{"type":22,"tag":56,"props":4039,"children":4040},{"__ignoreMap":8},[4041],{"type":22,"tag":60,"props":4042,"children":4043},{"class":62,"line":63},[4044,4049,4054,4059,4064,4069],{"type":22,"tag":60,"props":4045,"children":4046},{"style":151},[4047],{"type":34,"value":4048},"{",{"type":22,"tag":60,"props":4050,"children":4051},{"style":241},[4052],{"type":34,"value":4053},"\"shared_secret\"",{"type":22,"tag":60,"props":4055,"children":4056},{"style":151},[4057],{"type":34,"value":4058},":",{"type":22,"tag":60,"props":4060,"children":4061},{"style":73},[4062],{"type":34,"value":4063},"\"XXXX\"",{"type":22,"tag":60,"props":4065,"children":4066},{"style":151},[4067],{"type":34,"value":4068},",",{"type":22,"tag":60,"props":4070,"children":4072},{"style":4071},"--shiki-default:#FDAEB7;--shiki-default-font-style:italic",[4073],{"type":34,"value":4074},"...\n",{"type":22,"tag":23,"props":4076,"children":4077},{},[4078],{"type":34,"value":4079},"If not, and the content looks random, the file is likely encrypted. You can turn off encryption in the app under \"Manage Encryption\", in the top right corner.",{"type":22,"tag":23,"props":4081,"children":4082},{},[4083],{"type":34,"value":4084},"Closer to the middle of the file's object you will find",{"type":22,"tag":49,"props":4086,"children":4088},{"className":4034,"code":4087,"language":4036,"meta":8,"style":8},"\"identity_secret\":\"XXXX\"\n",[4089],{"type":22,"tag":56,"props":4090,"children":4091},{"__ignoreMap":8},[4092],{"type":22,"tag":60,"props":4093,"children":4094},{"class":62,"line":63},[4095,4100,4104],{"type":22,"tag":60,"props":4096,"children":4097},{"style":73},[4098],{"type":34,"value":4099},"\"identity_secret\"",{"type":22,"tag":60,"props":4101,"children":4102},{"style":151},[4103],{"type":34,"value":4058},{"type":22,"tag":60,"props":4105,"children":4106},{"style":73},[4107],{"type":34,"value":4108},"\"XXXX\"\n",{"type":22,"tag":23,"props":4110,"children":4111},{},[4112],{"type":34,"value":4113},"which is the second value you will need to automate trading.",{"type":22,"tag":37,"props":4115,"children":4117},{"id":4116},"next-steps",[4118],{"type":34,"value":4119},"Next steps",{"type":22,"tag":23,"props":4121,"children":4122},{},[4123,4125,4132],{"type":34,"value":4124},"If you are looking to develop SteamBots with trading capabilities yourself, and you enjoy developing with NodeJS, I suggest you check out McKay's ",{"type":22,"tag":882,"props":4126,"children":4129},{"href":4127,"rel":4128},"https:\u002F\u002Fgithub.com\u002FDoctorMcKay\u002Fnode-steam-tradeoffer-manager",[886],[4130],{"type":34,"value":4131},"tradeoffer manager",{"type":34,"value":4133}," and all of his other packages.",{"type":22,"tag":23,"props":4135,"children":4136},{},[4137,4139,4143],{"type":34,"value":4138},"If you need help setting up, building, developing, and deploying applications utilizing SteamBots, do not hesitate to ",{"type":22,"tag":882,"props":4140,"children":4141},{"href":3761},[4142],{"type":34,"value":3764},{"type":34,"value":1037},{"type":22,"tag":835,"props":4145,"children":4146},{},[4147],{"type":34,"value":839},{"title":8,"searchDepth":172,"depth":172,"links":4149},[4150,4151,4152,4153,4154,4155,4156,4157],{"id":3815,"depth":172,"text":3818},{"id":3848,"depth":172,"text":3851},{"id":3881,"depth":172,"text":3884},{"id":3913,"depth":172,"text":3916},{"id":3932,"depth":172,"text":3935},{"id":3951,"depth":172,"text":3954},{"id":3970,"depth":172,"text":3973},{"id":4116,"depth":172,"text":4119},"content:articles:steam-desktop-authenticator.md","articles\u002Fsteam-desktop-authenticator.md","articles\u002Fsteam-desktop-authenticator",{"_path":3835,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":4162,"description":4163,"date":4164,"image":4165,"tags":4166,"body":4167,"_type":846,"_id":4413,"_source":848,"_file":4414,"_stem":4415,"_extension":851},"How to Obtain Your Steam API Key: A Step-by-Step Guide","Create a Steam Web API key for your Steam account, and remove the account restriction that can block registration.","2024-03-26","\u002Fimg\u002Farticles\u002Fhow-to-obtain-your-steam-api-key\u002Fapikey.jpg",[859,17],{"type":19,"children":4168,"toc":4405},[4169,4175,4180,4184,4189,4224,4230,4243,4249,4259,4267,4273,4286,4292,4297,4305,4311,4316,4322,4327,4335,4341,4346,4352,4357,4365,4371,4383,4387],{"type":22,"tag":23,"props":4170,"children":4171},{},[4172],{"type":22,"tag":27,"props":4173,"children":4174},{"alt":4162,"src":4165},[],{"type":22,"tag":23,"props":4176,"children":4177},{},[4178],{"type":34,"value":4179},"The Steam API key is a necessary component both for developers building applications utilizing the Steam API, but also increasingly for individuals using trading websites\u002Fservices where their trade offers must be tracked. In this guide, I'll show you how to create a Steam API key for your Steam account and help you remove an account restriction that might be stopping you.",{"type":22,"tag":37,"props":4181,"children":4182},{"id":3815},[4183],{"type":34,"value":3818},{"type":22,"tag":23,"props":4185,"children":4186},{},[4187],{"type":34,"value":4188},"Before creating a Steam API key, there are certain prerequisites that must be met:",{"type":22,"tag":971,"props":4190,"children":4191},{},[4192,4197,4210],{"type":22,"tag":975,"props":4193,"children":4194},{},[4195],{"type":34,"value":4196},"You must have a Steam account.",{"type":22,"tag":975,"props":4198,"children":4199},{},[4200,4202,4209],{"type":34,"value":4201},"Your account must not be limited (it must have spent $5.00 on games, see ",{"type":22,"tag":882,"props":4203,"children":4206},{"href":4204,"rel":4205},"https:\u002F\u002Fhelp.steampowered.com\u002Fen\u002Ffaqs\u002Fview\u002F71D3-35C2-AD96-AA3A",[886],[4207],{"type":34,"value":4208},"this support article",{"type":34,"value":911},{"type":22,"tag":975,"props":4211,"children":4212},{},[4213,4215,4222],{"type":34,"value":4214},"You should have read the ",{"type":22,"tag":882,"props":4216,"children":4219},{"href":4217,"rel":4218},"https:\u002F\u002Fsteamcommunity.com\u002Fdev\u002Fapiterms",[886],[4220],{"type":34,"value":4221},"Steam Web API Terms of Use",{"type":34,"value":4223}," to avoid breaches.",{"type":22,"tag":37,"props":4225,"children":4227},{"id":4226},"obtaining-your-steam-api-key",[4228],{"type":34,"value":4229},"Obtaining your Steam API key",{"type":22,"tag":23,"props":4231,"children":4232},{},[4233,4235,4241],{"type":34,"value":4234},"Firstly, navigate to ",{"type":22,"tag":882,"props":4236,"children":4239},{"href":4237,"rel":4238},"https:\u002F\u002Fsteamcommunity.com\u002Fdev\u002Fapikey",[886],[4240],{"type":34,"value":4237},{"type":34,"value":4242},", which is Steam's official page for registering for an API key.",{"type":22,"tag":37,"props":4244,"children":4246},{"id":4245},"step-1-unrestrict-your-account",[4247],{"type":34,"value":4248},"Step 1 — Unrestrict your account",{"type":22,"tag":23,"props":4250,"children":4251},{},[4252,4254],{"type":34,"value":4253},"If you are met with the following text when you navigate to the Steam API registration page linked above, your first step will be to remove the restriction on the account. If your account is not restricted, move along to ",{"type":22,"tag":815,"props":4255,"children":4256},{},[4257],{"type":34,"value":4258},"Step 2.",{"type":22,"tag":23,"props":4260,"children":4261},{},[4262],{"type":22,"tag":27,"props":4263,"children":4266},{"alt":4264,"src":4265},"A restricted account cannot use the Steam Web API","\u002Fimg\u002Farticles\u002Fhow-to-obtain-your-steam-api-key\u002Frestricted-account.png",[],{"type":22,"tag":23,"props":4268,"children":4270},{"className":4269},[1067],[4271],{"type":34,"value":4272},"A restricted account cannot use the Steam Web API.",{"type":22,"tag":23,"props":4274,"children":4275},{},[4276,4278,4284],{"type":34,"value":4277},"My preferred way to solve this is by adding $5 to the Steam wallet, which can later be spent on buying skins on the Steam market, thereby giving an effective \"cost\" of around a dollar. Head over to ",{"type":22,"tag":882,"props":4279,"children":4282},{"href":4280,"rel":4281},"https:\u002F\u002Fstore.steampowered.com\u002Fsteamaccount\u002Faddfunds",[886],[4283],{"type":34,"value":4280},{"type":34,"value":4285}," to add funds to the account, and select the minimum fund level, in my case it is €5.",{"type":22,"tag":37,"props":4287,"children":4289},{"id":4288},"step-2-enter-a-domain-name",[4290],{"type":34,"value":4291},"Step 2 — Enter a domain name",{"type":22,"tag":23,"props":4293,"children":4294},{},[4295],{"type":34,"value":4296},"Seeing as the API key is a \"Web\" API key, Steam wants a domain name for the application that will utilize the API key.",{"type":22,"tag":23,"props":4298,"children":4299},{},[4300],{"type":22,"tag":27,"props":4301,"children":4304},{"alt":4302,"src":4303},"Steam requires a domain name for the application that will use the Steam API key","\u002Fimg\u002Farticles\u002Fhow-to-obtain-your-steam-api-key\u002Fdomain-name.png",[],{"type":22,"tag":23,"props":4306,"children":4308},{"className":4307},[1067],[4309],{"type":34,"value":4310},"Steam requires a domain name for the application that will use the Steam API key.",{"type":22,"tag":23,"props":4312,"children":4313},{},[4314],{"type":34,"value":4315},"From my experience, this is not enforced, meaning any domain can be inserted. However, if you are giving the API key to someone else's application, e.g., a trading website, or using it for your own development project, it is recommended to use the domain \"localhost\".",{"type":22,"tag":37,"props":4317,"children":4319},{"id":4318},"step-3-mobile-authenticator-confirmation",[4320],{"type":34,"value":4321},"Step 3 — Mobile authenticator confirmation",{"type":22,"tag":23,"props":4323,"children":4324},{},[4325],{"type":34,"value":4326},"After entering a domain name, you will be met with the following prompt:",{"type":22,"tag":23,"props":4328,"children":4329},{},[4330],{"type":22,"tag":27,"props":4331,"children":4334},{"alt":4332,"src":4333},"Creating an API key requires confirmation in the Steam Authenticator app","\u002Fimg\u002Farticles\u002Fhow-to-obtain-your-steam-api-key\u002Fauthenticator-confirm.png",[],{"type":22,"tag":23,"props":4336,"children":4338},{"className":4337},[1067],[4339],{"type":34,"value":4340},"Creating an API key requires confirmation in the Steam Authenticator app.",{"type":22,"tag":23,"props":4342,"children":4343},{},[4344],{"type":34,"value":4345},"This is a relatively new security addition by Steam, which probably was implemented as a safeguard against the increasing number of \"API scams\" that were conducted. Just confirm the action in your app like you would any other Steam trade.",{"type":22,"tag":37,"props":4347,"children":4349},{"id":4348},"step-4-copy-api-key",[4350],{"type":34,"value":4351},"Step 4 — Copy API key",{"type":22,"tag":23,"props":4353,"children":4354},{},[4355],{"type":34,"value":4356},"After confirmation, your Steam Web API key has been generated!",{"type":22,"tag":23,"props":4358,"children":4359},{},[4360],{"type":22,"tag":27,"props":4361,"children":4364},{"alt":4362,"src":4363},"Steam API key visible for an account after confirming in the Steam Authenticator app","\u002Fimg\u002Farticles\u002Fhow-to-obtain-your-steam-api-key\u002Fapi-key-result.png",[],{"type":22,"tag":23,"props":4366,"children":4368},{"className":4367},[1067],[4369],{"type":34,"value":4370},"Steam API key visible for an account after confirming in the Steam Authenticator app.",{"type":22,"tag":23,"props":4372,"children":4373},{},[4374,4376,4381],{"type":34,"value":4375},"Now, you should ",{"type":22,"tag":815,"props":4377,"children":4378},{},[4379],{"type":34,"value":4380},"NEVER",{"type":34,"value":4382}," share your Steam API key with the public as I have done in this image. This will give attackers information about trades you are conducting, items you received, and other information. Steam is limiting the API key's use cases to prevent scams, but this is still not something you want to share with the world. Always think twice (and ask why) if someone asks you to provide them with your API key.",{"type":22,"tag":4384,"props":4385,"children":4386},"hr",{},[],{"type":22,"tag":23,"props":4388,"children":4389},{},[4390,4392,4396,4398,4404],{"type":34,"value":4391},"And that's it! I hope you found this guide useful. If you need any help, don't hesitate to ",{"type":22,"tag":882,"props":4393,"children":4394},{"href":3761},[4395],{"type":34,"value":3764},{"type":34,"value":4397},". If you are interested in hiring us to build a web application utilizing the Steam API — e.g. trading websites, gambling websites, keys-to-crypto trading bots, and other applications — see ",{"type":22,"tag":882,"props":4399,"children":4401},{"href":4400},"\u002F#services",[4402],{"type":34,"value":4403},"what we build",{"type":34,"value":1037},{"title":8,"searchDepth":172,"depth":172,"links":4406},[4407,4408,4409,4410,4411,4412],{"id":3815,"depth":172,"text":3818},{"id":4226,"depth":172,"text":4229},{"id":4245,"depth":172,"text":4248},{"id":4288,"depth":172,"text":4291},{"id":4318,"depth":172,"text":4321},{"id":4348,"depth":172,"text":4351},"content:articles:how-to-obtain-your-steam-api-key.md","articles\u002Fhow-to-obtain-your-steam-api-key.md","articles\u002Fhow-to-obtain-your-steam-api-key",{"_path":4417,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":4418,"description":4419,"date":4420,"image":4421,"tags":4422,"body":4423,"_type":846,"_id":6315,"_source":848,"_file":6316,"_stem":6317,"_extension":851},"\u002Farticles\u002Fsign-in-through-steam-using-nodejs","Sign in through Steam using NodeJS","Set up “Sign in through Steam” on your website with NodeJS, express-session, and Doctor McKay’s steam-signin library.","2024-03-24","\u002Fimg\u002Farticles\u002Fsign-in-through-steam\u002Fsignin.jpg",[859,861,17],{"type":19,"children":4424,"toc":6305},[4425,4431,4436,4450,4464,4470,4475,4502,4515,4553,4558,4645,4659,4665,4677,5113,5134,5190,5202,5222,5227,5233,5252,5258,5263,5437,5442,5448,5958,5970,5981,5986,5992,6116,6121,6127,6140,6189,6194,6202,6207,6220,6228,6234,6263,6267,6272,6291,6301],{"type":22,"tag":23,"props":4426,"children":4427},{},[4428],{"type":22,"tag":27,"props":4429,"children":4430},{"alt":4418,"src":4421},[],{"type":22,"tag":23,"props":4432,"children":4433},{},[4434],{"type":34,"value":4435},"Allowing your users to sign in through Steam is essential if you are operating a website connected to Steam’s services in any way. This way of authentication allows you to seamlessly collect a user’s SteamID64, thus allowing you to see their Steam inventory, profile picture, etc. In this article, I will teach you how to set up a “Sign in through Steam” system on your website using NodeJS.",{"type":22,"tag":23,"props":4437,"children":4438},{},[4439,4441,4448],{"type":34,"value":4440},"This article was updated after the ",{"type":22,"tag":882,"props":4442,"children":4445},{"href":4443,"rel":4444},"https:\u002F\u002Fgithub.com\u002Fliamcurry\u002Fpassport-steam",[886],[4446],{"type":34,"value":4447},"passport-steam",{"type":34,"value":4449}," library proved to have another vulnerability (which is not to be unexpected after 8 years of no maintenance).",{"type":22,"tag":23,"props":4451,"children":4452},{},[4453,4455,4462],{"type":34,"value":4454},"The solution herein utilizes a library built by the one and only ",{"type":22,"tag":882,"props":4456,"children":4459},{"href":4457,"rel":4458},"https:\u002F\u002Fgithub.com\u002FDoctorMcKay",[886],[4460],{"type":34,"value":4461},"Doctor McKay",{"type":34,"value":4463},", a true hero within the community of Steam API development.",{"type":22,"tag":37,"props":4465,"children":4467},{"id":4466},"npm-installs",[4468],{"type":34,"value":4469},"NPM Installs",{"type":22,"tag":23,"props":4471,"children":4472},{},[4473],{"type":34,"value":4474},"If you have not done it already, initialize a project in your folder of choice using a terminal:",{"type":22,"tag":49,"props":4476,"children":4480},{"className":4477,"code":4478,"language":4479,"meta":8,"style":8},"language-shell shiki shiki-themes github-dark","npm init -y\n","shell",[4481],{"type":22,"tag":56,"props":4482,"children":4483},{"__ignoreMap":8},[4484],{"type":22,"tag":60,"props":4485,"children":4486},{"class":62,"line":63},[4487,4492,4497],{"type":22,"tag":60,"props":4488,"children":4489},{"style":67},[4490],{"type":34,"value":4491},"npm",{"type":22,"tag":60,"props":4493,"children":4494},{"style":73},[4495],{"type":34,"value":4496}," init",{"type":22,"tag":60,"props":4498,"children":4499},{"style":241},[4500],{"type":34,"value":4501}," -y\n",{"type":22,"tag":23,"props":4503,"children":4504},{},[4505,4507,4513],{"type":34,"value":4506},"To utilize modules, add the following line somewhere inside your ",{"type":22,"tag":56,"props":4508,"children":4510},{"className":4509},[],[4511],{"type":34,"value":4512},"package.json",{"type":34,"value":4514}," file:",{"type":22,"tag":49,"props":4516,"children":4518},{"className":4034,"code":4517,"language":4036,"meta":8,"style":8},"{\n  \"type\": \"module\"\n}\n",[4519],{"type":22,"tag":56,"props":4520,"children":4521},{"__ignoreMap":8},[4522,4529,4546],{"type":22,"tag":60,"props":4523,"children":4524},{"class":62,"line":63},[4525],{"type":22,"tag":60,"props":4526,"children":4527},{"style":151},[4528],{"type":34,"value":2396},{"type":22,"tag":60,"props":4530,"children":4531},{"class":62,"line":172},[4532,4537,4541],{"type":22,"tag":60,"props":4533,"children":4534},{"style":241},[4535],{"type":34,"value":4536},"  \"type\"",{"type":22,"tag":60,"props":4538,"children":4539},{"style":151},[4540],{"type":34,"value":2409},{"type":22,"tag":60,"props":4542,"children":4543},{"style":73},[4544],{"type":34,"value":4545},"\"module\"\n",{"type":22,"tag":60,"props":4547,"children":4548},{"class":62,"line":198},[4549],{"type":22,"tag":60,"props":4550,"children":4551},{"style":151},[4552],{"type":34,"value":1262},{"type":22,"tag":23,"props":4554,"children":4555},{},[4556],{"type":34,"value":4557},"Afterwards, we are going to need some npm installs. The following installs are required:",{"type":22,"tag":49,"props":4559,"children":4561},{"className":4477,"code":4560,"language":4479,"meta":8,"style":8},"npm install express\nnpm install express-session\nnpm install steam-signin\nnpm install dotenv\nnpm install axios\n",[4562],{"type":22,"tag":56,"props":4563,"children":4564},{"__ignoreMap":8},[4565,4581,4597,4613,4629],{"type":22,"tag":60,"props":4566,"children":4567},{"class":62,"line":63},[4568,4572,4576],{"type":22,"tag":60,"props":4569,"children":4570},{"style":67},[4571],{"type":34,"value":4491},{"type":22,"tag":60,"props":4573,"children":4574},{"style":73},[4575],{"type":34,"value":109},{"type":22,"tag":60,"props":4577,"children":4578},{"style":73},[4579],{"type":34,"value":4580}," express\n",{"type":22,"tag":60,"props":4582,"children":4583},{"class":62,"line":172},[4584,4588,4592],{"type":22,"tag":60,"props":4585,"children":4586},{"style":67},[4587],{"type":34,"value":4491},{"type":22,"tag":60,"props":4589,"children":4590},{"style":73},[4591],{"type":34,"value":109},{"type":22,"tag":60,"props":4593,"children":4594},{"style":73},[4595],{"type":34,"value":4596}," express-session\n",{"type":22,"tag":60,"props":4598,"children":4599},{"class":62,"line":198},[4600,4604,4608],{"type":22,"tag":60,"props":4601,"children":4602},{"style":67},[4603],{"type":34,"value":4491},{"type":22,"tag":60,"props":4605,"children":4606},{"style":73},[4607],{"type":34,"value":109},{"type":22,"tag":60,"props":4609,"children":4610},{"style":73},[4611],{"type":34,"value":4612}," steam-signin\n",{"type":22,"tag":60,"props":4614,"children":4615},{"class":62,"line":217},[4616,4620,4624],{"type":22,"tag":60,"props":4617,"children":4618},{"style":67},[4619],{"type":34,"value":4491},{"type":22,"tag":60,"props":4621,"children":4622},{"style":73},[4623],{"type":34,"value":109},{"type":22,"tag":60,"props":4625,"children":4626},{"style":73},[4627],{"type":34,"value":4628}," dotenv\n",{"type":22,"tag":60,"props":4630,"children":4631},{"class":62,"line":227},[4632,4636,4640],{"type":22,"tag":60,"props":4633,"children":4634},{"style":67},[4635],{"type":34,"value":4491},{"type":22,"tag":60,"props":4637,"children":4638},{"style":73},[4639],{"type":34,"value":109},{"type":22,"tag":60,"props":4641,"children":4642},{"style":73},[4643],{"type":34,"value":4644}," axios\n",{"type":22,"tag":23,"props":4646,"children":4647},{},[4648,4650,4657],{"type":34,"value":4649},"Don’t have npm installed? Head over to ",{"type":22,"tag":882,"props":4651,"children":4654},{"href":4652,"rel":4653},"https:\u002F\u002Fnodejs.org",[886],[4655],{"type":34,"value":4656},"nodejs.org",{"type":34,"value":4658}," and install it for your operating system of choice.",{"type":22,"tag":37,"props":4660,"children":4662},{"id":4661},"start-building-the-server",[4663],{"type":34,"value":4664},"Start building the server",{"type":22,"tag":23,"props":4666,"children":4667},{},[4668,4670,4676],{"type":34,"value":4669},"Assuming we are working on a vanilla project, we will need to start with the necessary code to build a simple server. All the code can be found on ",{"type":22,"tag":882,"props":4671,"children":4674},{"href":4672,"rel":4673},"https:\u002F\u002Fgithub.com\u002Fkevalane\u002Fsign-in-through-steam",[886],[4675],{"type":34,"value":1101},{"type":34,"value":1037},{"type":22,"tag":49,"props":4678,"children":4680},{"className":1120,"code":4679,"language":1119,"meta":8,"style":8},"import express from \"express\";\nimport session from \"express-session\";\nimport SteamSignIn from \"steam-signin\";\nimport dotenv from \"dotenv\";\ndotenv.config();\nimport axios from \"axios\";\n\nconst realm = process.env.API_URL;\nconst signIn = new SteamSignIn(realm)\n\nconst app = express();\n\napp.use(session({\n    secret: process.env.SECRET,\n    resave: false,\n    saveUninitialized: true,\n}));\n\nconst port = 3000;\n\napp.listen(port, () => {\n    console.log('Listening, port ' + port);\n});\n",[4681],{"type":22,"tag":56,"props":4682,"children":4683},{"__ignoreMap":8},[4684,4709,4734,4759,4783,4798,4822,4829,4858,4888,4895,4920,4927,4953,4970,4987,5004,5012,5019,5044,5051,5076,5106],{"type":22,"tag":60,"props":4685,"children":4686},{"class":62,"line":63},[4687,4691,4696,4700,4705],{"type":22,"tag":60,"props":4688,"children":4689},{"style":145},[4690],{"type":34,"value":148},{"type":22,"tag":60,"props":4692,"children":4693},{"style":151},[4694],{"type":34,"value":4695}," express ",{"type":22,"tag":60,"props":4697,"children":4698},{"style":145},[4699],{"type":34,"value":159},{"type":22,"tag":60,"props":4701,"children":4702},{"style":73},[4703],{"type":34,"value":4704}," \"express\"",{"type":22,"tag":60,"props":4706,"children":4707},{"style":151},[4708],{"type":34,"value":169},{"type":22,"tag":60,"props":4710,"children":4711},{"class":62,"line":172},[4712,4716,4721,4725,4730],{"type":22,"tag":60,"props":4713,"children":4714},{"style":145},[4715],{"type":34,"value":148},{"type":22,"tag":60,"props":4717,"children":4718},{"style":151},[4719],{"type":34,"value":4720}," session ",{"type":22,"tag":60,"props":4722,"children":4723},{"style":145},[4724],{"type":34,"value":159},{"type":22,"tag":60,"props":4726,"children":4727},{"style":73},[4728],{"type":34,"value":4729}," \"express-session\"",{"type":22,"tag":60,"props":4731,"children":4732},{"style":151},[4733],{"type":34,"value":169},{"type":22,"tag":60,"props":4735,"children":4736},{"class":62,"line":198},[4737,4741,4746,4750,4755],{"type":22,"tag":60,"props":4738,"children":4739},{"style":145},[4740],{"type":34,"value":148},{"type":22,"tag":60,"props":4742,"children":4743},{"style":151},[4744],{"type":34,"value":4745}," SteamSignIn ",{"type":22,"tag":60,"props":4747,"children":4748},{"style":145},[4749],{"type":34,"value":159},{"type":22,"tag":60,"props":4751,"children":4752},{"style":73},[4753],{"type":34,"value":4754}," \"steam-signin\"",{"type":22,"tag":60,"props":4756,"children":4757},{"style":151},[4758],{"type":34,"value":169},{"type":22,"tag":60,"props":4760,"children":4761},{"class":62,"line":217},[4762,4766,4770,4774,4779],{"type":22,"tag":60,"props":4763,"children":4764},{"style":145},[4765],{"type":34,"value":148},{"type":22,"tag":60,"props":4767,"children":4768},{"style":151},[4769],{"type":34,"value":182},{"type":22,"tag":60,"props":4771,"children":4772},{"style":145},[4773],{"type":34,"value":159},{"type":22,"tag":60,"props":4775,"children":4776},{"style":73},[4777],{"type":34,"value":4778}," \"dotenv\"",{"type":22,"tag":60,"props":4780,"children":4781},{"style":151},[4782],{"type":34,"value":169},{"type":22,"tag":60,"props":4784,"children":4785},{"class":62,"line":227},[4786,4790,4794],{"type":22,"tag":60,"props":4787,"children":4788},{"style":151},[4789],{"type":34,"value":204},{"type":22,"tag":60,"props":4791,"children":4792},{"style":67},[4793],{"type":34,"value":209},{"type":22,"tag":60,"props":4795,"children":4796},{"style":151},[4797],{"type":34,"value":214},{"type":22,"tag":60,"props":4799,"children":4800},{"class":62,"line":267},[4801,4805,4809,4813,4818],{"type":22,"tag":60,"props":4802,"children":4803},{"style":145},[4804],{"type":34,"value":148},{"type":22,"tag":60,"props":4806,"children":4807},{"style":151},[4808],{"type":34,"value":1136},{"type":22,"tag":60,"props":4810,"children":4811},{"style":145},[4812],{"type":34,"value":159},{"type":22,"tag":60,"props":4814,"children":4815},{"style":73},[4816],{"type":34,"value":4817}," \"axios\"",{"type":22,"tag":60,"props":4819,"children":4820},{"style":151},[4821],{"type":34,"value":169},{"type":22,"tag":60,"props":4823,"children":4824},{"class":62,"line":286},[4825],{"type":22,"tag":60,"props":4826,"children":4827},{"emptyLinePlaceholder":221},[4828],{"type":34,"value":224},{"type":22,"tag":60,"props":4830,"children":4831},{"class":62,"line":304},[4832,4836,4841,4845,4849,4854],{"type":22,"tag":60,"props":4833,"children":4834},{"style":145},[4835],{"type":34,"value":1164},{"type":22,"tag":60,"props":4837,"children":4838},{"style":241},[4839],{"type":34,"value":4840}," realm",{"type":22,"tag":60,"props":4842,"children":4843},{"style":145},[4844],{"type":34,"value":249},{"type":22,"tag":60,"props":4846,"children":4847},{"style":151},[4848],{"type":34,"value":1178},{"type":22,"tag":60,"props":4850,"children":4851},{"style":241},[4852],{"type":34,"value":4853},"API_URL",{"type":22,"tag":60,"props":4855,"children":4856},{"style":151},[4857],{"type":34,"value":169},{"type":22,"tag":60,"props":4859,"children":4860},{"class":62,"line":322},[4861,4865,4870,4874,4878,4883],{"type":22,"tag":60,"props":4862,"children":4863},{"style":145},[4864],{"type":34,"value":1164},{"type":22,"tag":60,"props":4866,"children":4867},{"style":241},[4868],{"type":34,"value":4869}," signIn",{"type":22,"tag":60,"props":4871,"children":4872},{"style":145},[4873],{"type":34,"value":249},{"type":22,"tag":60,"props":4875,"children":4876},{"style":145},[4877],{"type":34,"value":254},{"type":22,"tag":60,"props":4879,"children":4880},{"style":67},[4881],{"type":34,"value":4882}," SteamSignIn",{"type":22,"tag":60,"props":4884,"children":4885},{"style":151},[4886],{"type":34,"value":4887},"(realm)\n",{"type":22,"tag":60,"props":4889,"children":4890},{"class":62,"line":340},[4891],{"type":22,"tag":60,"props":4892,"children":4893},{"emptyLinePlaceholder":221},[4894],{"type":34,"value":224},{"type":22,"tag":60,"props":4896,"children":4897},{"class":62,"line":379},[4898,4902,4907,4911,4916],{"type":22,"tag":60,"props":4899,"children":4900},{"style":145},[4901],{"type":34,"value":1164},{"type":22,"tag":60,"props":4903,"children":4904},{"style":241},[4905],{"type":34,"value":4906}," app",{"type":22,"tag":60,"props":4908,"children":4909},{"style":145},[4910],{"type":34,"value":249},{"type":22,"tag":60,"props":4912,"children":4913},{"style":67},[4914],{"type":34,"value":4915}," express",{"type":22,"tag":60,"props":4917,"children":4918},{"style":151},[4919],{"type":34,"value":214},{"type":22,"tag":60,"props":4921,"children":4922},{"class":62,"line":1297},[4923],{"type":22,"tag":60,"props":4924,"children":4925},{"emptyLinePlaceholder":221},[4926],{"type":34,"value":224},{"type":22,"tag":60,"props":4928,"children":4929},{"class":62,"line":1326},[4930,4935,4940,4944,4949],{"type":22,"tag":60,"props":4931,"children":4932},{"style":151},[4933],{"type":34,"value":4934},"app.",{"type":22,"tag":60,"props":4936,"children":4937},{"style":67},[4938],{"type":34,"value":4939},"use",{"type":22,"tag":60,"props":4941,"children":4942},{"style":151},[4943],{"type":34,"value":1244},{"type":22,"tag":60,"props":4945,"children":4946},{"style":67},[4947],{"type":34,"value":4948},"session",{"type":22,"tag":60,"props":4950,"children":4951},{"style":151},[4952],{"type":34,"value":264},{"type":22,"tag":60,"props":4954,"children":4955},{"class":62,"line":1349},[4956,4961,4966],{"type":22,"tag":60,"props":4957,"children":4958},{"style":151},[4959],{"type":34,"value":4960},"    secret: process.env.",{"type":22,"tag":60,"props":4962,"children":4963},{"style":241},[4964],{"type":34,"value":4965},"SECRET",{"type":22,"tag":60,"props":4967,"children":4968},{"style":151},[4969],{"type":34,"value":283},{"type":22,"tag":60,"props":4971,"children":4972},{"class":62,"line":1358},[4973,4978,4983],{"type":22,"tag":60,"props":4974,"children":4975},{"style":151},[4976],{"type":34,"value":4977},"    resave: ",{"type":22,"tag":60,"props":4979,"children":4980},{"style":241},[4981],{"type":34,"value":4982},"false",{"type":22,"tag":60,"props":4984,"children":4985},{"style":151},[4986],{"type":34,"value":283},{"type":22,"tag":60,"props":4988,"children":4989},{"class":62,"line":1405},[4990,4995,5000],{"type":22,"tag":60,"props":4991,"children":4992},{"style":151},[4993],{"type":34,"value":4994},"    saveUninitialized: ",{"type":22,"tag":60,"props":4996,"children":4997},{"style":241},[4998],{"type":34,"value":4999},"true",{"type":22,"tag":60,"props":5001,"children":5002},{"style":151},[5003],{"type":34,"value":283},{"type":22,"tag":60,"props":5005,"children":5006},{"class":62,"line":1443},[5007],{"type":22,"tag":60,"props":5008,"children":5009},{"style":151},[5010],{"type":34,"value":5011},"}));\n",{"type":22,"tag":60,"props":5013,"children":5014},{"class":62,"line":1470},[5015],{"type":22,"tag":60,"props":5016,"children":5017},{"emptyLinePlaceholder":221},[5018],{"type":34,"value":224},{"type":22,"tag":60,"props":5020,"children":5021},{"class":62,"line":1479},[5022,5026,5031,5035,5040],{"type":22,"tag":60,"props":5023,"children":5024},{"style":145},[5025],{"type":34,"value":1164},{"type":22,"tag":60,"props":5027,"children":5028},{"style":241},[5029],{"type":34,"value":5030}," port",{"type":22,"tag":60,"props":5032,"children":5033},{"style":145},[5034],{"type":34,"value":249},{"type":22,"tag":60,"props":5036,"children":5037},{"style":241},[5038],{"type":34,"value":5039}," 3000",{"type":22,"tag":60,"props":5041,"children":5042},{"style":151},[5043],{"type":34,"value":169},{"type":22,"tag":60,"props":5045,"children":5046},{"class":62,"line":1487},[5047],{"type":22,"tag":60,"props":5048,"children":5049},{"emptyLinePlaceholder":221},[5050],{"type":34,"value":224},{"type":22,"tag":60,"props":5052,"children":5053},{"class":62,"line":1515},[5054,5058,5063,5068,5072],{"type":22,"tag":60,"props":5055,"children":5056},{"style":151},[5057],{"type":34,"value":4934},{"type":22,"tag":60,"props":5059,"children":5060},{"style":67},[5061],{"type":34,"value":5062},"listen",{"type":22,"tag":60,"props":5064,"children":5065},{"style":151},[5066],{"type":34,"value":5067},"(port, () ",{"type":22,"tag":60,"props":5069,"children":5070},{"style":145},[5071],{"type":34,"value":1397},{"type":22,"tag":60,"props":5073,"children":5074},{"style":151},[5075],{"type":34,"value":1402},{"type":22,"tag":60,"props":5077,"children":5078},{"class":62,"line":1545},[5079,5084,5088,5092,5097,5101],{"type":22,"tag":60,"props":5080,"children":5081},{"style":151},[5082],{"type":34,"value":5083},"    console.",{"type":22,"tag":60,"props":5085,"children":5086},{"style":67},[5087],{"type":34,"value":2371},{"type":22,"tag":60,"props":5089,"children":5090},{"style":151},[5091],{"type":34,"value":1244},{"type":22,"tag":60,"props":5093,"children":5094},{"style":73},[5095],{"type":34,"value":5096},"'Listening, port '",{"type":22,"tag":60,"props":5098,"children":5099},{"style":145},[5100],{"type":34,"value":3060},{"type":22,"tag":60,"props":5102,"children":5103},{"style":151},[5104],{"type":34,"value":5105}," port);\n",{"type":22,"tag":60,"props":5107,"children":5108},{"class":62,"line":1554},[5109],{"type":22,"tag":60,"props":5110,"children":5111},{"style":151},[5112],{"type":34,"value":385},{"type":22,"tag":23,"props":5114,"children":5115},{},[5116,5118,5124,5126,5132],{"type":34,"value":5117},"We will also need to create a ",{"type":22,"tag":56,"props":5119,"children":5121},{"className":5120},[],[5122],{"type":34,"value":5123},".env",{"type":34,"value":5125}," file (you can rename the ",{"type":22,"tag":56,"props":5127,"children":5129},{"className":5128},[],[5130],{"type":34,"value":5131},".env.example",{"type":34,"value":5133}," if you are following along within the GitHub repository):",{"type":22,"tag":49,"props":5135,"children":5137},{"className":4477,"code":5136,"language":4479,"meta":8,"style":8},"SECRET=whatever-you-want\nAPI_URL=http:\u002F\u002Flocalhost:3000\nSTEAM_API_KEY=your-steam-api-key\n",[5138],{"type":22,"tag":56,"props":5139,"children":5140},{"__ignoreMap":8},[5141,5157,5173],{"type":22,"tag":60,"props":5142,"children":5143},{"class":62,"line":63},[5144,5148,5152],{"type":22,"tag":60,"props":5145,"children":5146},{"style":151},[5147],{"type":34,"value":4965},{"type":22,"tag":60,"props":5149,"children":5150},{"style":145},[5151],{"type":34,"value":1911},{"type":22,"tag":60,"props":5153,"children":5154},{"style":73},[5155],{"type":34,"value":5156},"whatever-you-want\n",{"type":22,"tag":60,"props":5158,"children":5159},{"class":62,"line":172},[5160,5164,5168],{"type":22,"tag":60,"props":5161,"children":5162},{"style":151},[5163],{"type":34,"value":4853},{"type":22,"tag":60,"props":5165,"children":5166},{"style":145},[5167],{"type":34,"value":1911},{"type":22,"tag":60,"props":5169,"children":5170},{"style":73},[5171],{"type":34,"value":5172},"http:\u002F\u002Flocalhost:3000\n",{"type":22,"tag":60,"props":5174,"children":5175},{"class":62,"line":198},[5176,5181,5185],{"type":22,"tag":60,"props":5177,"children":5178},{"style":151},[5179],{"type":34,"value":5180},"STEAM_API_KEY",{"type":22,"tag":60,"props":5182,"children":5183},{"style":145},[5184],{"type":34,"value":1911},{"type":22,"tag":60,"props":5186,"children":5187},{"style":73},[5188],{"type":34,"value":5189},"your-steam-api-key\n",{"type":22,"tag":23,"props":5191,"children":5192},{},[5193,5195,5201],{"type":34,"value":5194},"You can run this code using (given that you named your application file ",{"type":22,"tag":56,"props":5196,"children":5198},{"className":5197},[],[5199],{"type":34,"value":5200},"index.js",{"type":34,"value":1103},{"type":22,"tag":49,"props":5203,"children":5205},{"className":4477,"code":5204,"language":4479,"meta":8,"style":8},"node index.js\n",[5206],{"type":22,"tag":56,"props":5207,"children":5208},{"__ignoreMap":8},[5209],{"type":22,"tag":60,"props":5210,"children":5211},{"class":62,"line":63},[5212,5217],{"type":22,"tag":60,"props":5213,"children":5214},{"style":67},[5215],{"type":34,"value":5216},"node",{"type":22,"tag":60,"props":5218,"children":5219},{"style":73},[5220],{"type":34,"value":5221}," index.js\n",{"type":22,"tag":23,"props":5223,"children":5224},{},[5225],{"type":34,"value":5226},"If you get any errors at this point, make sure that all the packages are installed correctly.",{"type":22,"tag":37,"props":5228,"children":5230},{"id":5229},"set-steam-api-key",[5231],{"type":34,"value":5232},"Set Steam API key",{"type":22,"tag":23,"props":5234,"children":5235},{},[5236,5238,5243,5245,5250],{"type":34,"value":5237},"To obtain player details (like account name and avatar), you will need to set up an API key for your Steam account. I wrote another blog post that is available ",{"type":22,"tag":882,"props":5239,"children":5240},{"href":3835},[5241],{"type":34,"value":5242},"here",{"type":34,"value":5244},", taking you through all the necessary steps. Add it to the ",{"type":22,"tag":56,"props":5246,"children":5248},{"className":5247},[],[5249],{"type":34,"value":5123},{"type":34,"value":5251}," file above.",{"type":22,"tag":37,"props":5253,"children":5255},{"id":5254},"creating-the-primary-route",[5256],{"type":34,"value":5257},"Creating the primary route",{"type":22,"tag":23,"props":5259,"children":5260},{},[5261],{"type":34,"value":5262},"To be able to access the sign-in functionality, we need to expose a few routes. Firstly, we will build the route that users will get redirected to from the front-end.",{"type":22,"tag":49,"props":5264,"children":5266},{"className":1120,"code":5265,"language":1119,"meta":8,"style":8},"app.get('\u002Fapi\u002Fv1\u002Fauth\u002Fsteam', (req, res) => {\n    res.statusCode = 302;\n    res.setHeader(\n        \"Location\",\n        signIn.getUrl(process.env.API_URL + '\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\u002Freturn')\n    )\n    res.end();\n});\n",[5267],{"type":22,"tag":56,"props":5268,"children":5269},{"__ignoreMap":8},[5270,5321,5342,5359,5371,5406,5414,5430],{"type":22,"tag":60,"props":5271,"children":5272},{"class":62,"line":63},[5273,5277,5281,5285,5290,5295,5300,5304,5309,5313,5317],{"type":22,"tag":60,"props":5274,"children":5275},{"style":151},[5276],{"type":34,"value":4934},{"type":22,"tag":60,"props":5278,"children":5279},{"style":67},[5280],{"type":34,"value":1435},{"type":22,"tag":60,"props":5282,"children":5283},{"style":151},[5284],{"type":34,"value":1244},{"type":22,"tag":60,"props":5286,"children":5287},{"style":73},[5288],{"type":34,"value":5289},"'\u002Fapi\u002Fv1\u002Fauth\u002Fsteam'",{"type":22,"tag":60,"props":5291,"children":5292},{"style":151},[5293],{"type":34,"value":5294},", (",{"type":22,"tag":60,"props":5296,"children":5297},{"style":1384},[5298],{"type":34,"value":5299},"req",{"type":22,"tag":60,"props":5301,"children":5302},{"style":151},[5303],{"type":34,"value":2775},{"type":22,"tag":60,"props":5305,"children":5306},{"style":1384},[5307],{"type":34,"value":5308},"res",{"type":22,"tag":60,"props":5310,"children":5311},{"style":151},[5312],{"type":34,"value":1392},{"type":22,"tag":60,"props":5314,"children":5315},{"style":145},[5316],{"type":34,"value":1397},{"type":22,"tag":60,"props":5318,"children":5319},{"style":151},[5320],{"type":34,"value":1402},{"type":22,"tag":60,"props":5322,"children":5323},{"class":62,"line":172},[5324,5329,5333,5338],{"type":22,"tag":60,"props":5325,"children":5326},{"style":151},[5327],{"type":34,"value":5328},"    res.statusCode ",{"type":22,"tag":60,"props":5330,"children":5331},{"style":145},[5332],{"type":34,"value":1911},{"type":22,"tag":60,"props":5334,"children":5335},{"style":241},[5336],{"type":34,"value":5337}," 302",{"type":22,"tag":60,"props":5339,"children":5340},{"style":151},[5341],{"type":34,"value":169},{"type":22,"tag":60,"props":5343,"children":5344},{"class":62,"line":198},[5345,5350,5355],{"type":22,"tag":60,"props":5346,"children":5347},{"style":151},[5348],{"type":34,"value":5349},"    res.",{"type":22,"tag":60,"props":5351,"children":5352},{"style":67},[5353],{"type":34,"value":5354},"setHeader",{"type":22,"tag":60,"props":5356,"children":5357},{"style":151},[5358],{"type":34,"value":1440},{"type":22,"tag":60,"props":5360,"children":5361},{"class":62,"line":217},[5362,5367],{"type":22,"tag":60,"props":5363,"children":5364},{"style":73},[5365],{"type":34,"value":5366},"        \"Location\"",{"type":22,"tag":60,"props":5368,"children":5369},{"style":151},[5370],{"type":34,"value":283},{"type":22,"tag":60,"props":5372,"children":5373},{"class":62,"line":227},[5374,5379,5384,5388,5392,5396,5401],{"type":22,"tag":60,"props":5375,"children":5376},{"style":151},[5377],{"type":34,"value":5378},"        signIn.",{"type":22,"tag":60,"props":5380,"children":5381},{"style":67},[5382],{"type":34,"value":5383},"getUrl",{"type":22,"tag":60,"props":5385,"children":5386},{"style":151},[5387],{"type":34,"value":356},{"type":22,"tag":60,"props":5389,"children":5390},{"style":241},[5391],{"type":34,"value":4853},{"type":22,"tag":60,"props":5393,"children":5394},{"style":145},[5395],{"type":34,"value":3060},{"type":22,"tag":60,"props":5397,"children":5398},{"style":73},[5399],{"type":34,"value":5400}," '\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\u002Freturn'",{"type":22,"tag":60,"props":5402,"children":5403},{"style":151},[5404],{"type":34,"value":5405},")\n",{"type":22,"tag":60,"props":5407,"children":5408},{"class":62,"line":267},[5409],{"type":22,"tag":60,"props":5410,"children":5411},{"style":151},[5412],{"type":34,"value":5413},"    )\n",{"type":22,"tag":60,"props":5415,"children":5416},{"class":62,"line":286},[5417,5421,5426],{"type":22,"tag":60,"props":5418,"children":5419},{"style":151},[5420],{"type":34,"value":5349},{"type":22,"tag":60,"props":5422,"children":5423},{"style":67},[5424],{"type":34,"value":5425},"end",{"type":22,"tag":60,"props":5427,"children":5428},{"style":151},[5429],{"type":34,"value":214},{"type":22,"tag":60,"props":5431,"children":5432},{"class":62,"line":304},[5433],{"type":22,"tag":60,"props":5434,"children":5435},{"style":151},[5436],{"type":34,"value":385},{"type":22,"tag":23,"props":5438,"children":5439},{},[5440],{"type":34,"value":5441},"This code initializes the sign in, and then redirects to our own route, which we will build next.",{"type":22,"tag":37,"props":5443,"children":5445},{"id":5444},"build-return-route",[5446],{"type":34,"value":5447},"Build return route",{"type":22,"tag":49,"props":5449,"children":5451},{"className":1120,"code":5450,"language":1119,"meta":8,"style":8},"app.get('\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\u002Freturn', async (req, res) => {\n    res.setHeader('Content-Type', 'text\u002Fplain');\n    try {\n        let steamId = await signIn.verifyLogin(req.url);\n\n        const steamid64 = steamId.getSteamID64();\n        const response = await axios.get(`https:\u002F\u002Fapi.steampowered.com\u002FISteamUser\u002FGetPlayerSummaries\u002Fv0002\u002F?key=${process.env.STEAM_API_KEY}&steamids=${steamid64}`)\n        const { avatarfull, personaname } = response.data.response.players[0];\n\n        req.session.user = {\n            steamid64,\n            avatarfull,\n            personaname,\n        }\n        await req.session.save()\n\n        res.redirect(process.env.API_URL);\n    } catch (error) {\n        console.error(error);\n        return res.status(500).send('There was an error signing in.');\n    }\n});\n",[5452],{"type":22,"tag":56,"props":5453,"children":5454},{"__ignoreMap":8},[5455,5512,5545,5557,5593,5600,5629,5705,5754,5761,5777,5785,5793,5801,5808,5831,5838,5863,5879,5895,5944,5951],{"type":22,"tag":60,"props":5456,"children":5457},{"class":62,"line":63},[5458,5462,5466,5470,5475,5479,5484,5488,5492,5496,5500,5504,5508],{"type":22,"tag":60,"props":5459,"children":5460},{"style":151},[5461],{"type":34,"value":4934},{"type":22,"tag":60,"props":5463,"children":5464},{"style":67},[5465],{"type":34,"value":1435},{"type":22,"tag":60,"props":5467,"children":5468},{"style":151},[5469],{"type":34,"value":1244},{"type":22,"tag":60,"props":5471,"children":5472},{"style":73},[5473],{"type":34,"value":5474},"'\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\u002Freturn'",{"type":22,"tag":60,"props":5476,"children":5477},{"style":151},[5478],{"type":34,"value":2775},{"type":22,"tag":60,"props":5480,"children":5481},{"style":145},[5482],{"type":34,"value":5483},"async",{"type":22,"tag":60,"props":5485,"children":5486},{"style":151},[5487],{"type":34,"value":1207},{"type":22,"tag":60,"props":5489,"children":5490},{"style":1384},[5491],{"type":34,"value":5299},{"type":22,"tag":60,"props":5493,"children":5494},{"style":151},[5495],{"type":34,"value":2775},{"type":22,"tag":60,"props":5497,"children":5498},{"style":1384},[5499],{"type":34,"value":5308},{"type":22,"tag":60,"props":5501,"children":5502},{"style":151},[5503],{"type":34,"value":1392},{"type":22,"tag":60,"props":5505,"children":5506},{"style":145},[5507],{"type":34,"value":1397},{"type":22,"tag":60,"props":5509,"children":5510},{"style":151},[5511],{"type":34,"value":1402},{"type":22,"tag":60,"props":5513,"children":5514},{"class":62,"line":172},[5515,5519,5523,5527,5532,5536,5541],{"type":22,"tag":60,"props":5516,"children":5517},{"style":151},[5518],{"type":34,"value":5349},{"type":22,"tag":60,"props":5520,"children":5521},{"style":67},[5522],{"type":34,"value":5354},{"type":22,"tag":60,"props":5524,"children":5525},{"style":151},[5526],{"type":34,"value":1244},{"type":22,"tag":60,"props":5528,"children":5529},{"style":73},[5530],{"type":34,"value":5531},"'Content-Type'",{"type":22,"tag":60,"props":5533,"children":5534},{"style":151},[5535],{"type":34,"value":2775},{"type":22,"tag":60,"props":5537,"children":5538},{"style":73},[5539],{"type":34,"value":5540},"'text\u002Fplain'",{"type":22,"tag":60,"props":5542,"children":5543},{"style":151},[5544],{"type":34,"value":1254},{"type":22,"tag":60,"props":5546,"children":5547},{"class":62,"line":198},[5548,5553],{"type":22,"tag":60,"props":5549,"children":5550},{"style":145},[5551],{"type":34,"value":5552},"    try",{"type":22,"tag":60,"props":5554,"children":5555},{"style":151},[5556],{"type":34,"value":1402},{"type":22,"tag":60,"props":5558,"children":5559},{"class":62,"line":217},[5560,5565,5570,5574,5578,5583,5588],{"type":22,"tag":60,"props":5561,"children":5562},{"style":145},[5563],{"type":34,"value":5564},"        let",{"type":22,"tag":60,"props":5566,"children":5567},{"style":151},[5568],{"type":34,"value":5569}," steamId ",{"type":22,"tag":60,"props":5571,"children":5572},{"style":145},[5573],{"type":34,"value":1911},{"type":22,"tag":60,"props":5575,"children":5576},{"style":145},[5577],{"type":34,"value":1425},{"type":22,"tag":60,"props":5579,"children":5580},{"style":151},[5581],{"type":34,"value":5582}," signIn.",{"type":22,"tag":60,"props":5584,"children":5585},{"style":67},[5586],{"type":34,"value":5587},"verifyLogin",{"type":22,"tag":60,"props":5589,"children":5590},{"style":151},[5591],{"type":34,"value":5592},"(req.url);\n",{"type":22,"tag":60,"props":5594,"children":5595},{"class":62,"line":227},[5596],{"type":22,"tag":60,"props":5597,"children":5598},{"emptyLinePlaceholder":221},[5599],{"type":34,"value":224},{"type":22,"tag":60,"props":5601,"children":5602},{"class":62,"line":267},[5603,5607,5611,5615,5620,5625],{"type":22,"tag":60,"props":5604,"children":5605},{"style":145},[5606],{"type":34,"value":1957},{"type":22,"tag":60,"props":5608,"children":5609},{"style":241},[5610],{"type":34,"value":1318},{"type":22,"tag":60,"props":5612,"children":5613},{"style":145},[5614],{"type":34,"value":249},{"type":22,"tag":60,"props":5616,"children":5617},{"style":151},[5618],{"type":34,"value":5619}," steamId.",{"type":22,"tag":60,"props":5621,"children":5622},{"style":67},[5623],{"type":34,"value":5624},"getSteamID64",{"type":22,"tag":60,"props":5626,"children":5627},{"style":151},[5628],{"type":34,"value":214},{"type":22,"tag":60,"props":5630,"children":5631},{"class":62,"line":286},[5632,5636,5640,5644,5648,5652,5656,5660,5665,5670,5674,5679,5683,5687,5692,5696,5701],{"type":22,"tag":60,"props":5633,"children":5634},{"style":145},[5635],{"type":34,"value":1957},{"type":22,"tag":60,"props":5637,"children":5638},{"style":241},[5639],{"type":34,"value":1416},{"type":22,"tag":60,"props":5641,"children":5642},{"style":145},[5643],{"type":34,"value":249},{"type":22,"tag":60,"props":5645,"children":5646},{"style":145},[5647],{"type":34,"value":1425},{"type":22,"tag":60,"props":5649,"children":5650},{"style":151},[5651],{"type":34,"value":1430},{"type":22,"tag":60,"props":5653,"children":5654},{"style":67},[5655],{"type":34,"value":1435},{"type":22,"tag":60,"props":5657,"children":5658},{"style":151},[5659],{"type":34,"value":1244},{"type":22,"tag":60,"props":5661,"children":5662},{"style":73},[5663],{"type":34,"value":5664},"`https:\u002F\u002Fapi.steampowered.com\u002FISteamUser\u002FGetPlayerSummaries\u002Fv0002\u002F?key=${",{"type":22,"tag":60,"props":5666,"children":5667},{"style":151},[5668],{"type":34,"value":5669},"process",{"type":22,"tag":60,"props":5671,"children":5672},{"style":73},[5673],{"type":34,"value":1037},{"type":22,"tag":60,"props":5675,"children":5676},{"style":151},[5677],{"type":34,"value":5678},"env",{"type":22,"tag":60,"props":5680,"children":5681},{"style":73},[5682],{"type":34,"value":1037},{"type":22,"tag":60,"props":5684,"children":5685},{"style":241},[5686],{"type":34,"value":5180},{"type":22,"tag":60,"props":5688,"children":5689},{"style":73},[5690],{"type":34,"value":5691},"}&steamids=${",{"type":22,"tag":60,"props":5693,"children":5694},{"style":151},[5695],{"type":34,"value":1387},{"type":22,"tag":60,"props":5697,"children":5698},{"style":73},[5699],{"type":34,"value":5700},"}`",{"type":22,"tag":60,"props":5702,"children":5703},{"style":151},[5704],{"type":34,"value":5405},{"type":22,"tag":60,"props":5706,"children":5707},{"class":62,"line":304},[5708,5712,5717,5722,5726,5731,5736,5740,5745,5749],{"type":22,"tag":60,"props":5709,"children":5710},{"style":145},[5711],{"type":34,"value":1957},{"type":22,"tag":60,"props":5713,"children":5714},{"style":151},[5715],{"type":34,"value":5716}," { ",{"type":22,"tag":60,"props":5718,"children":5719},{"style":241},[5720],{"type":34,"value":5721},"avatarfull",{"type":22,"tag":60,"props":5723,"children":5724},{"style":151},[5725],{"type":34,"value":2775},{"type":22,"tag":60,"props":5727,"children":5728},{"style":241},[5729],{"type":34,"value":5730},"personaname",{"type":22,"tag":60,"props":5732,"children":5733},{"style":151},[5734],{"type":34,"value":5735}," } ",{"type":22,"tag":60,"props":5737,"children":5738},{"style":145},[5739],{"type":34,"value":1911},{"type":22,"tag":60,"props":5741,"children":5742},{"style":151},[5743],{"type":34,"value":5744}," response.data.response.players[",{"type":22,"tag":60,"props":5746,"children":5747},{"style":241},[5748],{"type":34,"value":2176},{"type":22,"tag":60,"props":5750,"children":5751},{"style":151},[5752],{"type":34,"value":5753},"];\n",{"type":22,"tag":60,"props":5755,"children":5756},{"class":62,"line":322},[5757],{"type":22,"tag":60,"props":5758,"children":5759},{"emptyLinePlaceholder":221},[5760],{"type":34,"value":224},{"type":22,"tag":60,"props":5762,"children":5763},{"class":62,"line":340},[5764,5769,5773],{"type":22,"tag":60,"props":5765,"children":5766},{"style":151},[5767],{"type":34,"value":5768},"        req.session.user ",{"type":22,"tag":60,"props":5770,"children":5771},{"style":145},[5772],{"type":34,"value":1911},{"type":22,"tag":60,"props":5774,"children":5775},{"style":151},[5776],{"type":34,"value":1402},{"type":22,"tag":60,"props":5778,"children":5779},{"class":62,"line":379},[5780],{"type":22,"tag":60,"props":5781,"children":5782},{"style":151},[5783],{"type":34,"value":5784},"            steamid64,\n",{"type":22,"tag":60,"props":5786,"children":5787},{"class":62,"line":1297},[5788],{"type":22,"tag":60,"props":5789,"children":5790},{"style":151},[5791],{"type":34,"value":5792},"            avatarfull,\n",{"type":22,"tag":60,"props":5794,"children":5795},{"class":62,"line":1326},[5796],{"type":22,"tag":60,"props":5797,"children":5798},{"style":151},[5799],{"type":34,"value":5800},"            personaname,\n",{"type":22,"tag":60,"props":5802,"children":5803},{"class":62,"line":1349},[5804],{"type":22,"tag":60,"props":5805,"children":5806},{"style":151},[5807],{"type":34,"value":2073},{"type":22,"tag":60,"props":5809,"children":5810},{"class":62,"line":1358},[5811,5816,5821,5826],{"type":22,"tag":60,"props":5812,"children":5813},{"style":145},[5814],{"type":34,"value":5815},"        await",{"type":22,"tag":60,"props":5817,"children":5818},{"style":151},[5819],{"type":34,"value":5820}," req.session.",{"type":22,"tag":60,"props":5822,"children":5823},{"style":67},[5824],{"type":34,"value":5825},"save",{"type":22,"tag":60,"props":5827,"children":5828},{"style":151},[5829],{"type":34,"value":5830},"()\n",{"type":22,"tag":60,"props":5832,"children":5833},{"class":62,"line":1405},[5834],{"type":22,"tag":60,"props":5835,"children":5836},{"emptyLinePlaceholder":221},[5837],{"type":34,"value":224},{"type":22,"tag":60,"props":5839,"children":5840},{"class":62,"line":1443},[5841,5846,5851,5855,5859],{"type":22,"tag":60,"props":5842,"children":5843},{"style":151},[5844],{"type":34,"value":5845},"        res.",{"type":22,"tag":60,"props":5847,"children":5848},{"style":67},[5849],{"type":34,"value":5850},"redirect",{"type":22,"tag":60,"props":5852,"children":5853},{"style":151},[5854],{"type":34,"value":356},{"type":22,"tag":60,"props":5856,"children":5857},{"style":241},[5858],{"type":34,"value":4853},{"type":22,"tag":60,"props":5860,"children":5861},{"style":151},[5862],{"type":34,"value":1254},{"type":22,"tag":60,"props":5864,"children":5865},{"class":62,"line":1470},[5866,5871,5875],{"type":22,"tag":60,"props":5867,"children":5868},{"style":151},[5869],{"type":34,"value":5870},"    } ",{"type":22,"tag":60,"props":5872,"children":5873},{"style":145},[5874],{"type":34,"value":3336},{"type":22,"tag":60,"props":5876,"children":5877},{"style":151},[5878],{"type":34,"value":3341},{"type":22,"tag":60,"props":5880,"children":5881},{"class":62,"line":1479},[5882,5887,5891],{"type":22,"tag":60,"props":5883,"children":5884},{"style":151},[5885],{"type":34,"value":5886},"        console.",{"type":22,"tag":60,"props":5888,"children":5889},{"style":67},[5890],{"type":34,"value":2894},{"type":22,"tag":60,"props":5892,"children":5893},{"style":151},[5894],{"type":34,"value":3358},{"type":22,"tag":60,"props":5896,"children":5897},{"class":62,"line":1487},[5898,5903,5908,5913,5917,5922,5926,5931,5935,5940],{"type":22,"tag":60,"props":5899,"children":5900},{"style":145},[5901],{"type":34,"value":5902},"        return",{"type":22,"tag":60,"props":5904,"children":5905},{"style":151},[5906],{"type":34,"value":5907}," res.",{"type":22,"tag":60,"props":5909,"children":5910},{"style":67},[5911],{"type":34,"value":5912},"status",{"type":22,"tag":60,"props":5914,"children":5915},{"style":151},[5916],{"type":34,"value":1244},{"type":22,"tag":60,"props":5918,"children":5919},{"style":241},[5920],{"type":34,"value":5921},"500",{"type":22,"tag":60,"props":5923,"children":5924},{"style":151},[5925],{"type":34,"value":911},{"type":22,"tag":60,"props":5927,"children":5928},{"style":67},[5929],{"type":34,"value":5930},"send",{"type":22,"tag":60,"props":5932,"children":5933},{"style":151},[5934],{"type":34,"value":1244},{"type":22,"tag":60,"props":5936,"children":5937},{"style":73},[5938],{"type":34,"value":5939},"'There was an error signing in.'",{"type":22,"tag":60,"props":5941,"children":5942},{"style":151},[5943],{"type":34,"value":1254},{"type":22,"tag":60,"props":5945,"children":5946},{"class":62,"line":1515},[5947],{"type":22,"tag":60,"props":5948,"children":5949},{"style":151},[5950],{"type":34,"value":1551},{"type":22,"tag":60,"props":5952,"children":5953},{"class":62,"line":1545},[5954],{"type":22,"tag":60,"props":5955,"children":5956},{"style":151},[5957],{"type":34,"value":385},{"type":22,"tag":23,"props":5959,"children":5960},{},[5961,5963,5969],{"type":34,"value":5962},"A lot going on here. The important section (that verifies the sign in) is the line where we get the authenticated user's ",{"type":22,"tag":56,"props":5964,"children":5966},{"className":5965},[],[5967],{"type":34,"value":5968},"steamId",{"type":34,"value":1037},{"type":22,"tag":23,"props":5971,"children":5972},{},[5973,5975,5980],{"type":34,"value":5974},"After this, we fetch typical info that applications display of the signed-in user, namely their Steam profile avatar, and their display name (",{"type":22,"tag":56,"props":5976,"children":5978},{"className":5977},[],[5979],{"type":34,"value":5730},{"type":34,"value":911},{"type":22,"tag":23,"props":5982,"children":5983},{},[5984],{"type":34,"value":5985},"This is then saved to our session, which allows us to maintain the signed-in state across requests. Like with the primary route, a redirect is present to another route.",{"type":22,"tag":37,"props":5987,"children":5989},{"id":5988},"home-route",[5990],{"type":34,"value":5991},"Home route",{"type":22,"tag":49,"props":5993,"children":5995},{"className":1120,"code":5994,"language":1119,"meta":8,"style":8},"app.get('\u002F', (req, res) => {\n    const { user } = req.session;\n    res.status(200).send(user);\n});\n",[5996],{"type":22,"tag":56,"props":5997,"children":5998},{"__ignoreMap":8},[5999,6047,6076,6109],{"type":22,"tag":60,"props":6000,"children":6001},{"class":62,"line":63},[6002,6006,6010,6014,6019,6023,6027,6031,6035,6039,6043],{"type":22,"tag":60,"props":6003,"children":6004},{"style":151},[6005],{"type":34,"value":4934},{"type":22,"tag":60,"props":6007,"children":6008},{"style":67},[6009],{"type":34,"value":1435},{"type":22,"tag":60,"props":6011,"children":6012},{"style":151},[6013],{"type":34,"value":1244},{"type":22,"tag":60,"props":6015,"children":6016},{"style":73},[6017],{"type":34,"value":6018},"'\u002F'",{"type":22,"tag":60,"props":6020,"children":6021},{"style":151},[6022],{"type":34,"value":5294},{"type":22,"tag":60,"props":6024,"children":6025},{"style":1384},[6026],{"type":34,"value":5299},{"type":22,"tag":60,"props":6028,"children":6029},{"style":151},[6030],{"type":34,"value":2775},{"type":22,"tag":60,"props":6032,"children":6033},{"style":1384},[6034],{"type":34,"value":5308},{"type":22,"tag":60,"props":6036,"children":6037},{"style":151},[6038],{"type":34,"value":1392},{"type":22,"tag":60,"props":6040,"children":6041},{"style":145},[6042],{"type":34,"value":1397},{"type":22,"tag":60,"props":6044,"children":6045},{"style":151},[6046],{"type":34,"value":1402},{"type":22,"tag":60,"props":6048,"children":6049},{"class":62,"line":172},[6050,6054,6058,6063,6067,6071],{"type":22,"tag":60,"props":6051,"children":6052},{"style":145},[6053],{"type":34,"value":1411},{"type":22,"tag":60,"props":6055,"children":6056},{"style":151},[6057],{"type":34,"value":5716},{"type":22,"tag":60,"props":6059,"children":6060},{"style":241},[6061],{"type":34,"value":6062},"user",{"type":22,"tag":60,"props":6064,"children":6065},{"style":151},[6066],{"type":34,"value":5735},{"type":22,"tag":60,"props":6068,"children":6069},{"style":145},[6070],{"type":34,"value":1911},{"type":22,"tag":60,"props":6072,"children":6073},{"style":151},[6074],{"type":34,"value":6075}," req.session;\n",{"type":22,"tag":60,"props":6077,"children":6078},{"class":62,"line":198},[6079,6083,6087,6091,6096,6100,6104],{"type":22,"tag":60,"props":6080,"children":6081},{"style":151},[6082],{"type":34,"value":5349},{"type":22,"tag":60,"props":6084,"children":6085},{"style":67},[6086],{"type":34,"value":5912},{"type":22,"tag":60,"props":6088,"children":6089},{"style":151},[6090],{"type":34,"value":1244},{"type":22,"tag":60,"props":6092,"children":6093},{"style":241},[6094],{"type":34,"value":6095},"200",{"type":22,"tag":60,"props":6097,"children":6098},{"style":151},[6099],{"type":34,"value":911},{"type":22,"tag":60,"props":6101,"children":6102},{"style":67},[6103],{"type":34,"value":5930},{"type":22,"tag":60,"props":6105,"children":6106},{"style":151},[6107],{"type":34,"value":6108},"(user);\n",{"type":22,"tag":60,"props":6110,"children":6111},{"class":62,"line":217},[6112],{"type":22,"tag":60,"props":6113,"children":6114},{"style":151},[6115],{"type":34,"value":385},{"type":22,"tag":23,"props":6117,"children":6118},{},[6119],{"type":34,"value":6120},"With this route, we are simply returning the data of the signed-in user (if they are signed in).",{"type":22,"tag":37,"props":6122,"children":6124},{"id":6123},"connecting-to-the-front-end",[6125],{"type":34,"value":6126},"Connecting to the front-end",{"type":22,"tag":23,"props":6128,"children":6129},{},[6130,6132,6138],{"type":34,"value":6131},"The ",{"type":22,"tag":56,"props":6133,"children":6135},{"className":6134},[],[6136],{"type":34,"value":6137},"\u002Fapi\u002Fv1\u002Fauth\u002Fsteam",{"type":34,"value":6139}," route is the one we redirect users to from the front-end using a simple href:",{"type":22,"tag":49,"props":6141,"children":6145},{"className":6142,"code":6143,"language":6144,"meta":8,"style":8},"language-html shiki shiki-themes github-dark","\u003Ca href=\"http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\">Sign in\u003C\u002Fa>\n","html",[6146],{"type":22,"tag":56,"props":6147,"children":6148},{"__ignoreMap":8},[6149],{"type":22,"tag":60,"props":6150,"children":6151},{"class":62,"line":63},[6152,6156,6161,6166,6170,6175,6180,6184],{"type":22,"tag":60,"props":6153,"children":6154},{"style":151},[6155],{"type":34,"value":1925},{"type":22,"tag":60,"props":6157,"children":6159},{"style":6158},"--shiki-default:#85E89D",[6160],{"type":34,"value":882},{"type":22,"tag":60,"props":6162,"children":6163},{"style":67},[6164],{"type":34,"value":6165}," href",{"type":22,"tag":60,"props":6167,"children":6168},{"style":151},[6169],{"type":34,"value":1911},{"type":22,"tag":60,"props":6171,"children":6172},{"style":73},[6173],{"type":34,"value":6174},"\"http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fv1\u002Fauth\u002Fsteam\"",{"type":22,"tag":60,"props":6176,"children":6177},{"style":151},[6178],{"type":34,"value":6179},">Sign in\u003C\u002F",{"type":22,"tag":60,"props":6181,"children":6182},{"style":6158},[6183],{"type":34,"value":882},{"type":22,"tag":60,"props":6185,"children":6186},{"style":151},[6187],{"type":34,"value":6188},">\n",{"type":22,"tag":23,"props":6190,"children":6191},{},[6192],{"type":34,"value":6193},"Having added this code, start your server and navigate to said URL, and you should be met with the following familiar official Steam page:",{"type":22,"tag":23,"props":6195,"children":6196},{},[6197],{"type":22,"tag":27,"props":6198,"children":6201},{"alt":6199,"src":6200},"Sign in page visible by navigating to localhost:3000\u002Fapi\u002Fv1\u002Fauth\u002Fsteam","\u002Fimg\u002Farticles\u002Fsign-in-through-steam\u002Fsteam-signin-page.webp",[],{"type":22,"tag":23,"props":6203,"children":6205},{"className":6204},[1067],[6206],{"type":34,"value":6199},{"type":22,"tag":23,"props":6208,"children":6209},{},[6210,6212,6218],{"type":34,"value":6211},"Now, sign in using your own Steam account and you will be redirected to the main page, ",{"type":22,"tag":56,"props":6213,"children":6215},{"className":6214},[],[6216],{"type":34,"value":6217},"localhost:3000\u002F",{"type":34,"value":6219},", where you will be met with the following:",{"type":22,"tag":23,"props":6221,"children":6222},{},[6223],{"type":22,"tag":27,"props":6224,"children":6227},{"alt":6225,"src":6226},"Data about steam user available after sign in","\u002Fimg\u002Farticles\u002Fsign-in-through-steam\u002Fsession-user.png",[],{"type":22,"tag":23,"props":6229,"children":6231},{"className":6230},[1067],[6232],{"type":34,"value":6233},"Data about steam user available after sign in.",{"type":22,"tag":23,"props":6235,"children":6236},{},[6237,6239,6245,6247,6253,6255,6261],{"type":34,"value":6238},"This is just the body of ",{"type":22,"tag":56,"props":6240,"children":6242},{"className":6241},[],[6243],{"type":34,"value":6244},"req.session.user",{"type":34,"value":6246}," (see the ",{"type":22,"tag":56,"props":6248,"children":6250},{"className":6249},[],[6251],{"type":34,"value":6252},"\u002F",{"type":34,"value":6254}," route, where you can see the ",{"type":22,"tag":56,"props":6256,"children":6258},{"className":6257},[],[6259],{"type":34,"value":6260},"res.send()",{"type":34,"value":6262},"). From this JSON data you can get the user’s Steam name, avatar, and their SteamID64.",{"type":22,"tag":37,"props":6264,"children":6265},{"id":4116},[6266],{"type":34,"value":4119},{"type":22,"tag":23,"props":6268,"children":6269},{},[6270],{"type":34,"value":6271},"This example only serves as a simple setup for you to build upon. For example, a real website will probably have a database where user information is stored, therefore you would need to manipulate the JSON data after authentication and insert the necessary information into your database of choice.",{"type":22,"tag":23,"props":6273,"children":6274},{},[6275,6277,6282,6284,6290],{"type":34,"value":6276},"If you have any questions, get in touch via ",{"type":22,"tag":882,"props":6278,"children":6279},{"href":3761},[6280],{"type":34,"value":6281},"contact",{"type":34,"value":6283}," or email ",{"type":22,"tag":882,"props":6285,"children":6287},{"href":6286},"mailto:kevin@jkmholding.com",[6288],{"type":34,"value":6289},"kevin@jkmholding.com",{"type":34,"value":1037},{"type":22,"tag":23,"props":6292,"children":6293},{},[6294,6296,6300],{"type":34,"value":6295},"If you are interested in hiring us to create a project utilizing the Steam API — e.g. trading bots, gambling websites, skin trading websites, and more — see ",{"type":22,"tag":882,"props":6297,"children":6298},{"href":4400},[6299],{"type":34,"value":4403},{"type":34,"value":1037},{"type":22,"tag":835,"props":6302,"children":6303},{},[6304],{"type":34,"value":839},{"title":8,"searchDepth":172,"depth":172,"links":6306},[6307,6308,6309,6310,6311,6312,6313,6314],{"id":4466,"depth":172,"text":4469},{"id":4661,"depth":172,"text":4664},{"id":5229,"depth":172,"text":5232},{"id":5254,"depth":172,"text":5257},{"id":5444,"depth":172,"text":5447},{"id":5988,"depth":172,"text":5991},{"id":6123,"depth":172,"text":6126},{"id":4116,"depth":172,"text":4119},"content:articles:sign-in-through-steam-using-nodejs.md","articles\u002Fsign-in-through-steam-using-nodejs.md","articles\u002Fsign-in-through-steam-using-nodejs",1786464664062]