liamcurry / passport-steam

Steam (OpenID) authentication strategy for Passport and Node.js.
MIT License
349 stars 104 forks source link

getting wrong steamid on <%= user.id %> #86

Closed skibaalex closed 6 years ago

skibaalex commented 6 years ago

just the last two number are incorrect. i have no clue why is that happenning

skibaalex commented 6 years ago

update

i'm getting the correct data from the /auth/steam but then when im trying to access user.id it rounds the last number up or down

example the steam id 767561198140718655 turns to 767561198140718650 and the id 76561198822112084 turn into 76561198822112090

andrewda commented 6 years ago

You should be saving the steamid as a string in your database

skibaalex commented 6 years ago

so basicly i cannot access it directly? could you show me an example of how to access it? its something to do with memory? an integer is a max 32 bit?

andrewda commented 6 years ago

Basically, a SteamID overflows the capacity of JavaScript's number type. If you store and access it as a string instead (I can't think of any situation in which you'd need it to be a number) you'll be good to go. passport-steam should return the SteamID as a string already, so I'd suspect something you're doing is converting or storing it as a number. You'll have to share your code for more in-depth answer.

skibaalex commented 6 years ago

yes you were right its allready a srting i changed var $id = <%=user.id%>; to var $id = '<%=user.id%>'; and im good to go =]