Trouble Linking Steam ID with Nakama in Unity

I am using Facepunch Steamworks (GitHub - Facepunch/Facepunch.Steamworks: Another fucking c# Steamworks implementation) inside a Unity Windows build, deployed via Steam. The device is authenticated first with the Nakama server, after which I try to get a steam auth token via SteamUser.GetAuthSessionTicketAsync() from the Steamworks API.

The returned ticket has a data field which is a byte array which I then pass to Client.LinkSteamAsync() - see code snippet below. This returns an error on the server:

  1. Versions: Nakama 3.7, Linux binary, Unity SDK
  2. Server Language: Go

Unity Code:

var ticket = await SteamUser.GetAuthSessionTicketAsync();
await NakamaConnect.Client.LinkSteamAsync(NakamaConnect.Session, BitConverter.ToString(ticket.Data), true);

Server Error:

{"level":"info","ts":"2022-01-05T07:18:12.505Z","caller":"server/core_link.go:361","msg":"Could not authenticate Steam profile.","error":"Invalid parameter, 3"}

:tv: Media:

Hey @prateek-sirah :wave:

I’ve not used the Facepunch.Steamworks library before - did you make sure to set the Steam App ID and Steam publisher key with your Nakama server set up?

    app_id: somevalue
    publisher_key: somevalue

Hi @novabyte - yes these are set up - I think the invalid parameter 3 is the steam token coming from unity but I could be wrong… one guess is that the byte array is not converting to a string in the way Nakama expects the token to come in…

There has been some fixes made to Nakama and Steam integration in the latest build of Nakama (v3.10.0) - Please upgrade to that and try again.

Will try this - on that note I was wondering if you were planning to upgrade your AWS images soon? I am using your CloudFormation templates there for my test servers, but 3.7.0 seems to be the last update on Heroic Labs in the AWS marketplace.

It turns out the token string format was the problem - the BitConverter apparently puts in dashes between the converted byte values. It worked after I changed




Thanks for your support! Please do let me know if you have any info on the AWS marketplace?

1 Like

Hi folks,

We are now trying to enable Steam Login on our Android build to enable cross-platform login. The simplest way to do this seems to be using OpenID, but this directly returns the user’s SteamID, as opposed to an auth token which I think Nakama expects if we call authenticateSteam.

Is there a way to directly add the user’s SteamID on the server side? The *api.user struct is writable, so I could set the SteamID directly there, but I am assuming that doesn’t update the database?

If you want to essentially just hold the Steam ID without importing Steam friends into Nakama’s friend system you have two options (obviously when you don’t have a Steam token);

  • Use AuthenticateCustom rather than AuthenticateSteam.
  • Pass in the Steam ID to one of the server calls, and then manually store it against the steam_id field in the users table in the database.

I’d strongly suggest going down AuthenticateCustom as it’s meant to be the place where the source of the ID is outside of Nakama.

Understood. Thanks @mofirouz