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.
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
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.
There are a few ways to generate development tokens.
rivet init (recommended)
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.
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.
Via CLI with
The easiest way to configure the development token is to configure it in the
By default, the Rivet CLI will create development tokens with the hostname
127.0.0.1 and use the ports configured in
To override the development hostname, set the
matchmaker.dev_hostname property to your hostname of choice. Do not include the port in
To override the development ports, each
matchmaker.docker.ports.* property has a
dev_port property to override the default port.
Development tokens via the Rivet Dashboard at My Game > API > Create Development Token have the same properties available as the CLI.