Server : nakama 3.21.1 use with docker compose
Client: C# | Unity
Hello, I’m using nakama custom authentication for login with Phone number and OTP & i link device id with “SystemInfo.deviceUniqueIdentifier” C# code for next logins via unity, but i get this error on server:
postgres-1 | 2024-04-02 03:55:59.310 UTC [30] ERROR: duplicate key value violates unique constraint "user_device_pkey"
postgres-1 | 2024-04-02 03:55:59.310 UTC [30] DETAIL: Key (id)=(8a11ead71a22f44a2e8f0b426220a44e8e7762cf) already exists.
postgres-1 | 2024-04-02 03:55:59.310 UTC [30] STATEMENT: INSERT INTO user_device (id, user_id) VALUES ($1, $2)
please add device id server side check in nakama and throw this error to client side
note: i can solve this simply by replacing “SystemInfo.deviceUniqueIdentifier” with “Guid.NewGuid()”
client side code:
public void LinkDevice()
{
client = new Client(connectionData.Scheme, connectionData.Host, connectionData.Port, connectionData.ServerKey, UnityWebRequestAdapter.Instance);
Client.LinkDeviceAsync(session, SystemInfo.deviceUniqueIdentifier);
}