Documentation

​
​

Development

User Acquisition

Monetization

Industry

Vivox Unity SDK

Vivox Unity SDK

Vivox
​
​
Vivox Unity SDK
  • Overview
  • Get started
  • Release notes
  • Developer guide
  • Tutorials
    • Implement Vivox Unity
    • Access Token Developer Guide
      • Access token terminology
      • Requests that require access tokens
      • Access token identifiers
      • Access token format
      • Access token examples
      • Generate a token from the client
      • Generate a token on a secure server
        • Example: C++
        • Example: C#
        • Example: Python
        • Example: JavaScript
      • Key update API
      • Access token error codes
  • Reference
  1. Vivox Unity SDK documentation

Example: Python

How to generate Vivox access tokens using Python code.
Read time 1 minute
Last updated 8 months ago

The following code is an example of how to generate access token in Python.
#!/usr/env/python############################################### Vivox Token Generation Example - Python#############################################import base64import hashlibimport hmacimport jsondef b64url(value): """Return a base64url-encoded str without trailing ='s""" return base64.urlsafe_b64encode(value).rstrip('=')def vx_generate_token(key, issuer, exp, vxa, vxi, f, t): ## Create dictionary of claims claims = { 'iss': issuer, 'exp': exp, 'vxa': vxa, 'vxi': vxi, 'f': f, 't': t } ## Header is static - base64url encoded {} header = b64url('{}') # Can also be defined as a constant "e30" ## Encode claims payload json_payload = b64url(json.dumps(claims)) ## Join segments to prepare for signing segments = [header, json_payload] to_sign = b'.'.join(segments) ## Sign token with key and HMACSHA256 sig = hmac.new(key, to_sign, hashlib.sha256).digest() segments.append(b64url(sig)) ## Join all 3 parts of token with . and return return b'.'.join(segments)if __name__ == '__main__': ## Example usage token = vx_generate_token('secret', 'issuer', 1559359105, 'join', 123456, 'sip:.username.@domain.vivox.com', 'sip:confctl-g-channelname@domain.vivox.com') print(token)

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.


    Report a problem with this page