identity

The identity function returns JSON Web Tokens (JWTs) that grants access to the user's data and their dashboard configurations. As these tokens must be signed on your servers, it's most likely your identity function will be making an HTTPS request to your own API.

An example of the identity function would be;


    <Vizzly.Dashboard
      queryEngineEndpoint={'<< Your query engine endpoint >>'}
      identity={async () => {
        const response = await fetch(
          '<< Your identity endpoint >>'
        );
        if (response.ok) {
          const tokens = await response.json();

          return tokens.accessTokens;
        }

        return null;

The identity function must return the access tokens in the following 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;
};

Server side

To learn about how to setup the server side of the identity logic, please see the docs here.