Handling game tokens

All Rivet API clients accept a token parameter upon initialization. This token is used to identify:

  • What game & namespace the lobby or game client belongs to and
  • What your API client is allowed to do.

For example:

import { RivetClient } from "@rivet-gg/api";
const RIVET = new RivetClient({ token: process.env.RIVET_TOKEN });

This document will talk about handling public, matchmaker lobby, and development tokens for your game.

Server-side lobby tokens

All lobby servers running on Rivet are automatically provided a unique lobby token in the RIVET_TOKEN environment variable. No extra work is required.

Public namespace tokens

If you are building an HTML5 game, skip to tokenless authentication for web.

To connect to your game, you need to generate a public namespace token. Do that by navigating to Developer > My Game > API > Create Public Token.

Create public token

This token needs to be included with the game client.

Tokenless authentication for web

Rivet can authenticate web browsers without any tokens by what domain API requests are sent from. In this case, no token needs to be provided at all to the API client.

See here for more details.

Development tokens

When developing your game locally, you can still use the Rivet API by using development tokens. These act as real tokens whenever possible and return mock responses when needed.

See here for more details.


Open-source multiplayer infrastructure. Easy, flexible, and affordable.

This website is not sponsored by or affiliated with Unity Technologies or its affiliates. Unity Trademark(s) are trademark(s) or registered trademark(s) of Unity Technologies or its affiliates in the U.S. and elsewhere. | This website is not sponsored by, affiliated with, or endorsed by Epic Games, Inc. or its affiliates. 'Unreal Engine' is a trademark or registered trademark of Epic Games, Inc. in the U.S. and elsewhere. | The HTML5 Logo by the World Wide Web Consortium (W3C), used under a Creative Commons Attribution 3.0 License. Source | The Godot Engine Logo by the Andrea Calabró, used under a Creative Commons Attribution 4.0 International License. Source | Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein.

© 2024 Rivet Gaming, Inc. All rights reserved.