# Generate a token on the client

> Generate access tokens directly from your game client for prototyping and testing.

> **Important:**
>
> Use the following access token generation methods during initial development and prototyping. Do not include this method of generation in production builds of your game. Allowing token generation on the client during production is both a security risk and can cause unexpected token expiration errors for your users.

To generate your access token, call vx\_debug\_generate\_token() with the following parameters:

* The issuer
* The expiration time in epoch seconds since January 1, 1970 UTC
* The action (for example, "mute")
* A serial number (a simple static incrementing counter is adequate - this allows for the generation of more than one request in the same second for the same set of claims)
* An optional subject (the target for kick and mute actions, null otherwise)
* The from URI (always the signing in or signed in user URI - required for all actions)
* The to URI (null for the login action, and the channel URI for join, kick, and mute)
* A pointer to a buffer holding the token signing key
* The length of the token signing key

The following examples display access tokens for login, join, join\_muted, kick, and mute, respectively:

```plaintext
static long long serialNumber = 0;
// Login
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "login", serialNumber++, NULL, "sip:.issuer.me.@mt1s.vivox.com", NULL, (const unsigned char *)key, (int)strlen(key));

// Join
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "join", serialNumber++, NULL, "sip:.issuer.me.@mt1s.vivox.com", "sip:confctl-g-issuer.lobby@mt1s.vivox.com", (const unsigned char *)key, (int)strlen(key));

// Join Muted
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "join_muted", serialNumber++, NULL, "sip:.issuer.me.@mt1s.vivox.com", "sip:confctl-g-issuer.lobby@mt1s.vivox.com", (const unsigned char *)key, (int)strlen(key));

// Kick
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "kick", serialNumber++, "sip:.issuer.them.@mt1s.vivox.com", "sip:.issuer.me.@mt1s.vivox.com", "sip:confctl-g-issuer.lobby@mt1s.vivox.com", (const unsigned char *)key, (int)strlen(key));

// Mute
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "mute", serialNumber++, "sip:.issuer.them.@mt1s.vivox.com", "sip:.issuer.me.@mt1s.vivox.com", "sip:confctl-g-issuer.lobby@mt1s.vivox.com", (const unsigned char *)key, (int)strlen(key));

// Transcription
request->access_token = vx_debug_generate_token("issuer", time(NULL) + 120, "trxn", serialNumber++, NULL, "sip:.issuer.me.@mt1s.vivox.com", "sip:confctl-g-issuer.lobby@mt1s.vivox.com", (const unsigned char *)key, (int)strlen(key));
```
