Add deviceId to account.Devices?

I’m working on a way to store all the devices a user has logged in with that they want to log in easily to (not have to type credentials in again every time). For this: a “Remember Me” toggle when they first log in to make sure they’re cool with it. The next time the game loads there’s a button for their account that autofills the credential fields.

Initially I started by creating a new collection called “devices” on the user’s storage. Then I found that the account variable (var account = await client.GetAccountAsync(session);) has a private list of devices (account.Devices).

My question is: How do I add the current deviceId to this list? It seems I can reference it, but it’s always blank, even when I’ve logged in to the same device several times.

Thanks!

1 Like

@EarthAdam Have a look at the link and unlink API which is used to “link” additional authentication options to a user account? These links all become options to authenticate the user with.

https://heroiclabs.com/docs/authentication/#link-or-unlink

It sounds like your “devices” storage table might be an adhoc way you’ve tried to build to achieve what the server already provides out of the box.

2 Likes

Good call, I missed that. On the plus side I have a way of allowing multiple users per device, although I imagine that’s not widely needed functionality.
Thanks!

1 Like

I don’t see an option to “mark as solution” anymore

No worries. Things have changed a little with the forum structure so posts with “development” but not on the SDKs don’t have a “solution” plugin enabled anymore. Maybe we should change that approach. What do you think @erlend_sh?

1 Like

Cool, I see it back. Thanks guys

2 Likes