Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question LobbyService (401) HTTP/1.1 401 Unauthorized

Discussion in 'Lobby' started by kogacchi, Nov 17, 2023.

  1. kogacchi

    kogacchi

    Joined:
    May 1, 2021
    Posts:
    1
    Hello.
    Developed using Lobby from Unity Gaming Services.

    Running the lobby function in the Editor results in an "HTTP/1.1 401 Unauthorized" error.
    Same as the thread below, only after exiting play mode and running it again.
    https://forum.unity.com/threads/http-1-1-401-unauthorized.1313526/
    My current version is using Unity 2022.3.3f1, Lobby 1.1.0

    Is there an established solution to the content of this thread?

    I tried various cases, but I was able to reproduce it even in a simple case.
    I will paste the source code for one case.

    Code (CSharp):
    1.     private async void OnEnable()
    2.     {
    3.         joinedLobby = null;
    4.         await SignIn();
    5.         joinedLobby = await CreateLobbyAsync("test lobby", 2);
    6.         Debug.Log($" Id:{joinedLobby.Id}, Name:{joinedLobby.Name}");
    7.     }
    8.  
    9.     private async Task<Lobby> CreateLobbyAsync(string lobbyName, int maxPlayers)
    10.     {
    11.         return await Lobbies.Instance.CreateLobbyAsync(lobbyName, maxPlayers);
    12.     }
    13.  
    14.     private async Task SignIn()
    15.     {
    16.         await UnityServices.InitializeAsync();
    17.         await AuthenticationService.Instance.SignInAnonymouslyAsync();
    18.     }
    19.  
    20.     void OnDisable()
    21.     {
    22.         if (AuthenticationService.Instance.IsSignedIn)
    23.             AuthenticationService.Instance.SignOut(true);
    24.     }

    By the way, the phenomenon is reproduced regardless of whether SignOut processing is performed or not.
    When I rerun it, an error occurs at CreateLobbyAsync()
     
  2. unity_2nwniWovIsEvnw

    unity_2nwniWovIsEvnw

    Joined:
    Oct 9, 2020
    Posts:
    3
    I have a similar problem when trying to Query for a lobby list, but I still haven't found a solution either.