Skip to main content

odin_token_generator_create_token_ex

Generates a signed JWT such as odin_token_generator_create_token and allows passing a custom set of OdinTokenOptions for advanced use-cases. This function will only be needed if you want to connect to an on-premise hosted server without using a gateway.

danger

This function should not be used in production as the access key will be exposed in the client application. You can use our simple server side token server to generate tokens for your clients. See our guides on access keys and tokens for more information.

Declaration
OdinReturnCode odin_token_generator_create_token_ex(struct OdinTokenGenerator *generator,
const char *room_id,
const char *user_id,
const struct OdinTokenOptions *options,
char *out_token,
size_t out_token_len);

Parameters

generator

Handle of the token generator used to create the token. See

OdinTokenGenerator

for more information.

Declaration
OdinTokenGenerator *generator;

room_id

ID of the room for which the token will be generated. It can be any null-terminated string.

Declaration
const char *room_id;

user_id

ID of the user for which the token will be generated. It can be any null-terminated string.

danger

It should not contain personal data (in the definition of GDPR) like an email address. Use a unique identifier for the user. This should be a Steam ID, Discord ID, or any other unique identifier from your authentication system.

Declaration
const char *user_id;

out_token

Pointer to a buffer where the generated token will be stored.

Declaration
char *out_token;

out_token_len

Size of the buffer for the token.

Declaration
size_t out_token_len;

options

Pointer to the options used to configure the token generation. See

OdinTokenOptions

for more information.

Declaration
const OdinTokenOptions *options;

Returns

A return code indicating success or failure.

Return Type
OdinReturnCode