文档

​
​

Development

User Acquisition

Monetization

工业

Vivox Core SDK

Vivox Core SDK

此页面不支持所选语言。
Vivox
​
​
Vivox Core SDK
  • Overview
  • Before you begin
  • Get started
  • Release notes
  • Developer Guide
  • Reference
    • Access Token Developer Guide
      • Access token terminology
      • Requests that require access tokens
      • Access token identifiers
      • Access token format
      • Access token examples
      • Generate a token on the client
      • Generate a token on a secure server
        • Example: C++
        • Example: C#
        • Example: Python
        • Example: JavaScript
      • Key update API
      • Override development key generation
      • Access token error codes
    • Server to Server Web API Reference Guide
    • Core API Reference Manual
    • Third-party license information
  • Privacy overview
  1. Vivox Core SDK documentation

Example: Python

How to generate Vivox access tokens using Python code.
阅读时间1 分钟
最后更新于 8 个月前

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
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。


    报告此页面的问题