API Privacy Access Token

Server-Side API endpoint to fetch a privacy access token that grants your dApp access to fetch Privacy Data.

This endpoint fetches a privacy access token, which you need in order to fetch Privacy Data from a user.

NOTE: There is a service library available to you in the Quadrata SDK, for this endpoint.

API endpoint to get a privacy access token

GET https://int.quadrata.com/api/v1/privacy/access/${account}

Path Parameters

Headers

{
  "data": {
    "authToken": "...",
    "accessToken": "...",
    "type": "privacy.grants"
  }
}

This endpoint will return an auth token and an access token. Your dApp needs to combine them into one encoded string, delimited by a : and base64 encoded, in order to use it as an X-Access-Token header to fetch PII data.

Privacy Access Tokens are one time use tokens. If you attempt to reuse an access token, you will receive a 401 Unauthorized error.

const buffer = require('buffer');

const privateKeyDer = '...';
// You can find `getPrivateKeyFromDer` in "How to sign API"."Full Example" page
const privateKey = await getPrivateKeyFromDer(privateKeyDer);

const walletAddress = '...';

// You can find `makeRequest` in "How to sign API"."Full Example" page
const json = await makeRequest({
    method: 'get',
    privateKey: privateKey,
    path: `/api/v1/privacy/access/${walletAddress}`
});
const { data: { authToken, accessToken } } = json;

const xAccessToken = Buffer
    .from(`${authToken}:${accessToken}`)
    .toString('base64');

See How to sign API for message signing examples with more coverage and explanations.

Last updated