Hi there, I keep getting a
“Unity.Services.Lobbies.LobbyServiceException: (401) HTTP/1.1 401 Unauthorized”
when trying to call LobbyService.Instance.CreateLobbyAsync on a Multiplay Dedicated Server. I’ve tried authenticating with both ServerAuthenticationService.Instance.SignInWithServiceAccountAsync and ServerAuthenticationService.Instance.SignInFromServerAsync. Same result. I’ve checked ServerAuthenticationService.Instance.IsAuthorized, which returned true in both case. I’ve cleared my access policies “statements”: . I could not find any Lobby-related role for the Service Account to be assigned. What am I missing?
ServerConfigLoader serverConfigLoader = new();
string apiKeyIdentifier = serverConfigLoader.GetConfigVariable("serviceAccountIdentifier");
string apiKeySecret = serverConfigLoader.GetConfigVariable("serviceAccountSecret");
Debug.Log("Is server authorized (startup before sign-in): " + ServerAuthenticationService.Instance.IsAuthorized);
await ServerAuthenticationService.Instance.SignInWithServiceAccountAsync(apiKeyIdentifier, apiKeySecret);
Debug.Log("Is server authorized (startup after sign-in): " + ServerAuthenticationService.Instance.IsAuthorized);
StartServer();
I checked in the log of the server, the variable retrieved correctly.
Is server authorized (startup before sign-in): False
Is server authorized (startup after sign-in): True
I checked again in the class that is calling CreateLobbyAsync and it’s still returning true. Is it possible to call CreateLobbyAsync from a Dedicated Server? Should it be done exclusively from the API alternatively using Session?
Thank you very much in advance for your help!