Create Access Token

Quadrata SDK API Service: Create Access Token

Create a JWT authentication token for use in the onboarding client components and other API services.

Parameters

NameTypeDescription

apiKey*

string

Your API Key

options

object

API and Fetch Options

Parameter Options

NameTypeDescription

allowUnsafeClientApiCall

boolean

Allow service to run in client

SDK Configuration

NameTypeDescription

environment*

QuadrataEnvironment

Access token See createAccessToken

See API Authentication for more information about the underlying API endpoint.

Example

import type { API } from '@quadrata/sdk/types';
import { createAccessToken, QuadrataEnvironment } from '@quadrata/sdk/api';

type ResponseType = API.Services.CreateAccessToken.Response;

const response: ResponseType = await createAccessToken(
    {
        apiKey: process.env.QUADRATA_API_KEY,
        options: {
            // not recommended as it exposes your API key
            allowUnsafeClientApiCall: true,
            
            // optional fetch options
            cache: 'no-cache'
        }
    },
    { environment: QuadrataEnvironment.PRODUCTION }
);

const { data: { accessToken } } = response;

Last updated