# Trouble Linking Steam ID with Nakama in Unity

**URL:** <https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234>\
**Category:** Game Design\
**Tags:** sdk-unity, authentication\
**Created:** [January 5, 2022, 9:35am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234 "2022-01-05T09:35:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 5, 2022, 9:35am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/1 "2022-01-05T09:35:41Z")

</div>

I am using Facepunch Steamworks ([GitHub - Facepunch/Facepunch.Steamworks: Another fucking c# Steamworks implementation](https://github.com/Facepunch/Facepunch.Steamworks)) 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:

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

```

Server Error:

```auto
{"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"}

```

📺 **Media:**

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [January 5, 2022, 10:28am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/2 "2022-01-05T10:28:13Z")

</div>

Hey @prateek-sirah 👋

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?

```auto
social:
  steam:
    app_id: somevalue
    publisher_key: somevalue

```

---

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 5, 2022, 10:33am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/3 "2022-01-05T10:33:08Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 5, 2022, 12:50pm UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/4 "2022-01-05T12:50:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 6, 2022, 5:04am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/5 "2022-01-06T05:04:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 6, 2022, 6:03am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/6 "2022-01-06T06:03:43Z")

</div>

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

```auto
BitConverter.ToString(ticket.Data)

```

to

```auto
BitConverter.ToString(ticket.Data).Replace("-","")

```

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

---

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 13, 2022, 12:35pm UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/7 "2022-01-13T12:35:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [January 14, 2022, 12:38am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/8 "2022-01-14T00:38:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![prateek-sirah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/prateek-sirah/32/943_2.png) [@prateek-sirah](https://forum.heroiclabs.com/u/prateek-sirah)\
**Post date:** [January 14, 2022, 4:20am UTC](https://forum.heroiclabs.com/t/trouble-linking-steam-id-with-nakama-in-unity/2234/9 "2022-01-14T04:20:38Z")

</div>

Understood. Thanks @mofirouz
