Python

This guide takes you through using the Vizzly Python Client (opens in a new tab) to sign the identity config securely on your servers.

Install

pip3 install git+https://github.com/vizzly-co/python.git#egg=vizzly

Import

import vizzly

Variable setup

expiry_ttl_in_minutes=60
 
# https://docs.vizzly.co/concepts/identity-config/access-type
access_type = 'admin'
 
# https://docs.vizzly.co/parameters
organisation_id = 'org_9817c013a80944cea5890df34ab792cd'
 
# Parent dashboard ID
dashboard_id='dsh_c0ef7773f0d249e49365ae535d02860b'
 
# https://docs.vizzly.co/concepts/identity-config/scope
scope='read_write'
 
# https://docs.vizzly.co/concepts/identity-config/user-reference
user_reference = 'usr-123'
 
# https://docs.vizzly.co/concepts/identity-config/data-sets
data_set_ids = '*'
 
# https://docs.vizzly.co/concepts/identity-config/secure-filters
secure_filters = {}

Create the dashboard access token

dashboard_access_token = vizzly.sign_dashboard_access_token(
  expiry_ttl_in_minutes,
  access_type,
  organisation_id,
  dashboard_id,
  user_reference,
  scope,
  PRIVATE_KEY
)

Create the data access token

data_access_token = vizzly.sign_data_access_token(
  expiry_ttl_in_minutes,
  data_set_ids,
  secure_filters,
  PRIVATE_KEY
)

Create the query engine access token (optional)

optionalself-hosted
query_engine_access_token = vizzly.sign_query_engine_access_token(
  expiry_ttl_in_minutes,
  True,
  True,
  private_key=PRIVATE_KEY
)

Next steps

Now that you have created the access tokens, you will want to return the access tokens to the client. For example, you might be calling this auth endpoint from the identity function used on the Dashboard. If that's the case, then you'll want to return the tokens in a JSON structure of this format;

{
  /** Required */
  dashboardAccessToken: string;
  /** Required if you are using the self-hosted Vizzly query engine */
  dataAccessToken?: string;
  /** Optional if the user has access to the config manager */
  queryEngineAccessToken?: string;
}

Now that you are finished generating access tokens for Vizzly, you might be interested in;