Jump to content
McKay Development

Using steam-passport in conjunction with steam-community


Barak

Recommended Posts

Hey McKay, loving the work that you've done for the steam and JS communities.

 

I've been using your `steamcommunity` package, but I've ran into this weird problem. 

 

I want to use the `getSteamUser` method on the community class.

My user is logged in via a Passport Steam strategy and that returns an object after the user logs in that looks like this:

 

 image.png.a1d60a4ad812c2bc3370b3bfb3a2809a.png

 

this is my account. Right, so I deserialize this data in a session and work with the `steamid` property since that is the only one I need to perform actions etc.

But, when trying to use `getSteamUser` with this steamId it throws `Cannot find user`. I realize that it wants a steamID object or a URL as specified here

  • id - Either a SteamID object or a user's URL (the part after /id/)\

but even when calling by my URL which in the above case it's `psychoqt` manually I get this back:

image.png.0a7c0da05e82025b1ede1b4760edf423.png

Now as you can see the steamID object is filled with universe type etc, but the accountID is different. It is not the steam ID. Even if I compose this object myself, I would be missing

the accountid from the previous payload.

 

The only solution I can see here is to parse `profileurl` and take everything right from `/id/` but it seems kinda hacky and inconsistent. Is there any other way I could go around this?

 

Thanks,,

Filip

Link to comment
Share on other sites

A SteamID object is an object, not a string containing the 64-bit SteamID. See info here from the SteamCommunity docs.

The SteamID returned when you retrieve the user's profile from their vanity URL is indeed correct:

> const SteamID = require('steamid')
> let sid = new SteamID()
> sid.universe = 1
> sid.type = 1
> sid.instance = 1
> sid.accountid = 117631762
> sid.getSteamID64()
'76561198077897490'

If you have the SteamID e.g. from passport-steam, then this is how you'd call getSteamUser:

const SteamCommunity = require('steamcommunity');
let community = new SteamCommunity();
community.getSteamUser(new SteamCommunity.SteamID('76561198077897490'), (err, user) => {
    // . . .
});

That said, if all you're doing with node-steamcommunity is retrieving users' profile details, you're far better off using the WebAPI for that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...