@vizzly/auth
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@vizzly/auth

Vizzly auth is a JavaScript library for providing Vizzly identity configs from a server endpoint running NodeJs.

The @vizzly/auth package contains only the functionality necessary to sign Vizzly identity configs. It is used together with @vizzly/dashboard and React on the frontend to render a dashboard which your users can customise.

Usage

import { createSigner } from '@vizzly/auth';

const generateVizzlyTokens = async (
  privateKey: string, accessType: 'admin' | 'standard', dataSetIds: ('*' | string)[], userReference: string
  ): Promise<{dashboardAccessToken: string, dataAccessToken: string}> => {

  const vizzAuth = createSigner({
    privateKey,
    ttlInMinutes: 60
  });

  let identityConfig = {
    // A unique reference to the current user
    userReference,

    // Is the user able to modify the dashboard template sent to all your users?
    accessType,

    // Which data sets does this user have access too?
    dataSetIds,

    // https://docs.vizzly.co/callbacks/identity#multi-tenancy-with-secure-filters
    secureFilters: {},

    // https://docs.vizzly.co/parameters
    organisationId: "org_12345", // Your organisation ID
  };

  const tokens = await vizzAuth.generateTokens(identityConfig);

  return tokens;
};

export default generateVizzlyTokens;

Documentation

See https://docs.vizzly.co

Website

See https://vizzly.co

Keywords

none

Install

npm i @vizzly/auth

DownloadsWeekly Downloads

795

Version

0.1.0

License

none

Unpacked Size

100 kB

Total Files

14

Last publish

Collaborators

  • jamesbowers