Development tokens


What are development tokens?

Development tokens are built to let you develop your game on your local machine with access to production APIs. When needed, API endpoints will send mock responses for development tokens.

Ideally, each developer generates a token for their local development. The token should not be committed to version control.


Mock responses

In some cases, there's no way to return a valid response when developing on your local machine.

For example, the matchmaker.lobbies.find endpoint will mock a fake address pointing to your local development server. It will also return a development player token that act as a real player token.


Store your token in a .env file

We recommend storing the development token in a .env file that is not committed to version control. The CLI will ask to automatically create a .env file with your development token when setting up your project.

If you're not familiar with .env files, read more here. There are libraries to load .env files for most languages.



Generating tokens

There are a few ways to generate development tokens.

Running rivet init will automatically check your .env file to see if you have a development token. If not, it will prompt you to create one automatically.

We recommend letting the Rivet CLI store this token in your .env for you since this is a safe place to keep it.

Via CLI: rivet dev create-dev-token

You can manually generate a development token similar to rivet init with the command rivet dev create-dev-token.

Via GUI: Rivet Dashboard

A development token can be created via the Rivet Dashboard in My Game > API > Create Development Token.

This is useful when generating one-off tokens where you need to override the hostname to test a multiplayer game on separate devices.

Create dev token

Configuring tokens

The easiest way to configure the development token is to configure it in the rivet.yaml file.

By default, the Rivet CLI will create development tokens with the hostname 127.0.0.1 and use the ports configured in matchmaker.docker.ports.*.

To override the development hostname, set the matchmaker.dev_hostname property to your hostname of choice. Do not include the port in dev_hostname.

To override the development ports, each matchmaker.docker.ports.* property has a dev_port property to override the default port.

Via GUI

Development tokens via the Rivet Dashboard at My Game > API > Create Development Token have the same properties available as the CLI.

Configure dev token

Rivet

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.