Developer Documentation

Understanding Access Keys

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 Examples section to grab some code snippets to help you generate ODIN room rokens in a secure way.

Generating Access Keys

Every access key is a 44 character long Base64-String, which consists of an internal version mumber, 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.

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
#include <stdio.h>

#include "odin.h"

int main()
{
  char access_key[128];
  char key_id[64];
  int error;

  error = odin_access_key_generate(access_key, sizeof(access_key));

  if (odin_is_error(error))
  {
    printf("Failed to generate access key; error %d\n", error);
    return 1;
  }

  printf("Your new access key is: %s\n", access_key);

  error = odin_access_key_id(access_key, key_id, sizeof(key_id));

  if (odin_is_error(error))
  {
    printf("Failed to get key ID from access key; error %d\n", error);
    return 1;
  }

  printf("The key ID for your access key is: %s\n", key_id);

  return 0;
}
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’ve 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 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:

graph LR
  RandomBytes[Random Bytes] --> AccessKey;
  AccessKey[Access Key] --> PublicKey;
  AccessKey --> SecretKey[Secret Key];
  PublicKey[Public Key] --> KeyId[Key ID];

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 what 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.