Skip to main content

Understanding Access Keys

Here’s the converted content using the updated transformation rules:

An access key is your unique authentication key to be used to generate room tokens for accessing the 4Players ODIN server network. Think of it as your individual username and password combination all wrapped up into a single non-comprehendable string of characters, and treat it with the same respect.

"Important Notice"

All clients that want to join the same ODIN room need to use a token generated from either the same access key or another access key of the same project.

While you can create an unlimited number of access keys for your projects, we strongly recommend that you never put an access key in your client code. Please refer to the Token Server Example to grab some code snippets to help you generate ODIN room tokens in a secure way.

Generating Access Keys

Every access key is a 44-character long Base64 string, which consists of an internal version number, a set of random bytes, and a checksum. We're providing several methods for generating new access keys using our SDKs.

You can create an access key for up to 25 concurrent users for free directly in the widget below.

ODIN Access Key Generator

Click on the button to create an access key that you can use for free for up to 25 concurrent users.

Using the SDK

We're providing several ways to create access keys locally using one of our SDKs. The resulting access keys can be used to access the ODIN network with up to 25 concurrently connected users free of charge.

Generate Access Key and retrieve its Key ID
var odinTokens = require("@4players/odin-tokens")

var accessKey = odinTokens.generateAccessKey();

console.log("Your new access key is: " + accessKey);

var keyPair = odinTokens.loadAccessKey(accessKey);
var keyId = odinTokens.getKeyId(keyPair.publicKey);

console.log("The key ID for your access key is: " + keyId);

If you have an active ODIN subscription, contact us to submit the public key for an existing access key.

With ODIN Command Line Utility

We provide an NPM-based command line utility that you can use to generate an access key. Install it with this command:

npm install -g @4players/odin-cli

Then, you can use the command-line tool in your terminal to generate an access key:

odin-cli create-access-key

You'll get a response similar to this one. You can use the access key in all SDKs available.

Your access key:
AQMaxMG2nLNvdUCdHp+lZKfNYKuxs4Vb/O7kPI4rEeX2
Please note: This access key is only valid for up to 25 users and may not be used in production!
Sign up to generate access keys for production and/or more users: https://app.tarif-config.4players.de/config/149/en_GB

Flowchart

The relationships between the individual components of an access key are as follows:

Terminology

Access Key:
Gives access to the ODIN network. It is a 44-character long Base64 string, which consists of a version, random bytes, and a checksum.

Secret Key:
Generated from the access key, it is based on the Ed25519 curve and used to sign a room generated by the game developer.

Public Key:
Generated from the access key, it is based on the Ed25519 curve and must be uploaded to 4Players so that a generated room token can be verified.

Key ID:
A shortened public key, included in the token, making it possible to identify which public key must be used to verify the room token.

Room Token:
A signed JWT given to the game clients that allows them to connect to a voice chat room in the ODIN network.