API servers commonly return 403 status codes to inform users that they are forbidden from accessing a resource. When a user submits a request, the server performs an authorization function depending on the supplied credentials. When working with the Relay and Lobby SDKs, users commonly observe 403 errors in one of two situations:
- A Unity Gaming Services (UGS) account is not attached and activated in the local project. Therefore, the SDK does not set the appropriate authentication header in the request.
- A Unity Gaming Services (UGS) account is attached and activated in the local project, but the associated account is unauthorized from accessing the Lobby & Relay API.
To troubleshoot this issue, we recommend that users go through the standard setup procedure and ensure all steps have been completed:
1. Open the Unity Gaming Services dashboard by navigating to https://dashboard.unity3d.com/. First, ensure that you have selected the appropriate project you would like to enable services on. This can be done by clicking the dropdown and selecting the project's name. If you do not have a UGS project yet, click the dropdown and select Create project. Note that each UGS project has its own settings, and it is possible to have Relay and Lobby enabled correctly for one project and not the other.
2. Along the left side, you will see a collection of service suites. Under the product, you are having issues with, select Multiplayer > Overview Note that if this is your first time in the Unity dashboard, instead of Overview you may see Getting Started which will have a setup guide that will walk you through the remaining steps.
3. After opening either Relay or Lobby, you will see a toggle switch indicating if the service is activated or not. Ensure that the toggle is switched On. This allows linked projects to successfully submit API requests to the respective service.
4. In the Unity Editor, open your project settings by selecting Edit > Project Settings. A new window opens with various options for configuring your project. To open UGS settings, navigate to the left panel and select Services. Here, you can configure which UGS project your local project is associated with. If not already configured, select the appropriate organization and project you have enabled the Relay and Lobby services for.
After completing this change, you should no longer receive 403 errors within your project. In some rare situations, you may still receive 403 errors. If this applies to you, please submit a ticket, and a developer support engineer will assist you in resolving the issue.