Broadleaf Microservices
  • v1.0.0-latest-prod

Preview Token

The following operation allows you to validate a sandbox-preview (Preview-on-Site) token. Preview-on-Site functionality allows admin user to preview what their changes will look like on the commerce-facing site before the changes go live. In order to see non-deployed changes, a special auth token is generated and the user is redirected from the admin to the storefront. The storefront app then needs to validate the token before updating the preview header in requests to other APIs.

Table of Contents

Validate Preview Token

Operation

SandboxClient#validatePreviewToken(token, options);

Parameters

Parameter Type Required? Description

token

string

Provide a sandbox-preview token name to fetch.

options

SandboxClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a PreviewTokenValidated.

Example

Example of validating a token
const previewTokenValidated = await sandboxClient.validatePreviewToken('TOKEN');

console.log(previewTokenValidated);