Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwrapped SteamProfile #282

Merged
merged 2 commits into from
Jan 4, 2019
Merged

Unwrapped SteamProfile #282

merged 2 commits into from
Jan 4, 2019

Conversation

nielslanting
Copy link
Contributor

The steam_id of users authenticated through Steam was always set to 0.
The response of the AuthenticateUserTicket looks like this:

{
    "response": {
        "params": {
            "result": "OK",
            "steamid": "76561197993712720",
            "ownersteamid": "76561197993712720",
            "vacbanned": false,
            "publisherbanned": false
        }
    }
}

Now it properly sets the correct steam_id in the database.

The steam_id of users authenticated through Steam was always set to 0.
The response of the AuthenticateUserTicket looks like this:

```
{
    "response": {
        "params": {
            "result": "OK",
            "steamid": "76561197993712720",
            "ownersteamid": "76561197993712720",
            "vacbanned": false,
            "publisherbanned": false
        }
    }
}
```

Now it properly sets the correct steam_id in the database.
@nielslanting
Copy link
Contributor Author

Also worth mentioning, the steamid is returned as a string. It get's converted to a uint64. Everywhere it is used it gets converted back to a string. The database type is text. Why is the steamid getting converted to a uint64?

@zyro
Copy link
Member

zyro commented Jan 4, 2019

Per Steam docs steamid is a uint64 and serialised over JSON as a string. We don't need the underlying numeric value at all it's just checked for input validation purposes. Do you think it's more reliable to just use the string as it's received?

I can also see we use the v0001 which was latest when that integration was written but per the docs it looks like v1 is now latest. @nielslanting What do you think about updating and retesting if you have a test case set up already?

@nielslanting
Copy link
Contributor Author

nielslanting commented Jan 4, 2019

I am not sure whether it's more reliable or not so I will leave the steamid as is.

The response of the v1 endpoint is identical to the v0001 endpoint.

Changed the AuthenticateUserTicket version from v0001 to v1
@zyro zyro merged commit 171587a into heroiclabs:master Jan 4, 2019
@zyro
Copy link
Member

zyro commented Jan 4, 2019

@nielslanting Thanks!

@nielslanting
Copy link
Contributor Author

I retested it with the v1 endpoint and it works. But this begs the question is no one using the Steam integration?

@nielslanting
Copy link
Contributor Author

nielslanting commented Jan 4, 2019

If the users enters an invalid ticket an account with steamid 0 is created. I don't think that's expected behavior. The response of a request with an invalid ticket to the AuthenticateUserTicket endpoint looks like this: 200 OK

{
    "response": {
        "error": {
            "errorcode": 3,
            "errordesc": "Invalid parameter"
        }
    }
}

@zyro
Copy link
Member

zyro commented Jan 4, 2019

It's not the most popular integration. Most PC games I'm aware of that use Nakama have preferred email/password authentication for various reasons - usually to ensure Steam and non-Steam audience accounts are unified, but it's up to them.

Looks like in error cases the Steam Web API does not set a non-200 response code, and the decoding of the result does not fail so the Go default value for a uint64 of 0 is used. We can add a guard to ensure that doesn't happen and optionally attempt to decode the "error" field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants