403 Forbidden (used to work before with same code)

Hi , I have been using lobby for the last weeks and it had been working fine. Today I started getting consistent 403 Forbidden when creating the lobby. (Creating the relay still works). Also I checked that I still have the “Lobby On” toggle enabled on the dashboard.

Is there any change in permissions required to create a Lobby?

The code goes like this:

(Creating the Relay succeeds).

    public struct RelayServerData
    {
        public string joinCode;
        public string ipv4Address;
        public ushort port;
        public byte[] allocationIdBytes;
        public byte[] keyBytes;
        public byte[] connectionDataBytes;
        public byte[] hostConnectionDataBytes;
        public bool isHost;
    }

    public async Task<RelayServerData> CreateRelay()
    {
        Allocation allocation;
        allocation = await Relay.Instance.CreateAllocationAsync(4);
        Debug.Log($"Host ConnectionData: {ByteArrayToString(allocation.ConnectionData)}");
        Debug.Log($"Host AllocationId: {allocation.AllocationId}");
        string createdJoinCode = await Relay.Instance.GetJoinCodeAsync(allocation.AllocationId);
        Debug.Log("Relay Join code: " + createdJoinCode);
        return new RelayServerData
        {
            joinCode = createdJoinCode,
            ipv4Address = allocation.RelayServer.IpV4,
            port = (ushort)allocation.RelayServer.Port,
            allocationIdBytes = allocation.AllocationIdBytes,
            keyBytes = allocation.Key,
            connectionDataBytes = allocation.ConnectionData,
            hostConnectionDataBytes = allocation.ConnectionData,
            isHost = true,
        };
    }

    public async void CreateLobby()
    {
        // these work
        await UnityServices.InitializeAsync();
        await AuthenticationService.Instance.SignInAnonymouslyAsync();
        var relayData = await CreateRelay();

        // this fails with 403
        lobby = await Lobbies.Instance.CreateLobbyAsync("mylobby", 4, new CreateLobbyOptions
        {
            Player = new Unity.Services.Lobbies.Models.Player(
                id: AuthenticationService.Instance.PlayerId,
                connectionInfo: relayData.joinCode,
                allocationId: relayData.allocationIdBytes.ToString()
            ),
        });

Oh, worked now. Maybe some intermittent issue? Weird that it shows as Forbidden as opposed to e.g. connection error or other.

Hi there,

I believe there was an intermittent issue earlier today where authenticated calls to the Lobby service were occasionally returning 403 Forbidden, which looks to be resolved. As of right now, I’m testing your code and am able to create lobbies without any errors.

If this pops up again, please also feel free to submit a ticket.

Cheers :slight_smile: