# SharinPix Token Viewer

{% hint style="info" %}
The **SharinPix Token Viewer** component permits the user to open any component using a token.
{% endhint %}

{% hint style="warning" %}
**Note:**

The SharinPix Token Viewer component works **only** with the [SharinPix Online Tokens](https://docs.sharinpix.com/documentation/best-practices/working-with-sharinpix-tokens#sharinpix-online-token).

For more information on the type of SharinPix Tokens, refer to the following article: [Working with SharinPix Tokens](https://docs.sharinpix.com/documentation/best-practices/working-with-sharinpix-tokens)
{% endhint %}

{% hint style="info" %}
**Information:**

This feature is only available on Lightning. It can be used:

* On Page Builder
* On Desktop
* On Mobile
* On Community Builder
  {% endhint %}

## Getting Started

To use the SharinPix Token Viewer component, you simply need to drag and drop the component from the Lightning App Builder onto your page layout.

<figure><img src="https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-17df2c7c951788deee87bb4ffa3ea2b9b391e288%2Fimage%20(18).png?alt=media" alt=""><figcaption></figcaption></figure>

## Lightning Component Parameters

<figure><img src="https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-97405ae98904135cd1da965d90e30a074d8379a7%2Fimage%20(19).png?alt=media" alt=""><figcaption></figcaption></figure>

* **Token Field API Name:** The API name of the field containing the SharinPix token.
* **SharinPix Secured Token Name:** The name of the 'SharinPix Secured Token' Custom Metadata configured for the token viewer component. More information on how to configure the SharinPix Secured Token below.
* **Height:** Used to specify the component's height. The default height is **500** (px).

{% hint style="warning" %}
**Note:**

If the **SharinPix Secured Token Name** is set, the **Token Field API Name** is ignored.
{% endhint %}

### SharinPix Secured Token Setting

The SharinPix Secured Token will be used to create a token that expires. The expired token will be used on the token viewer component. Using the SharinPix Secured Token, the Token Viewer component will not use the token stored in the Salesforce field directly; instead, it will generate a new token that expires. This adds a layer of security as the token stored on Salesforce, which may be non-expiring, is not exposed in the user's browser.

Steps to configure the SharinPix Secured Token:

1. Go to Salesforce Setup
2. Open Custom Metadata Types
3. Click on Manage Records for **SharinPix Secured Token** Custom metadata type
4. Insert a label and name
5. For the **Object name** parameter, insert the object API name on which the SharinPix Token Viewer component has been added.
6. For the **Field name** parameter, insert the field API name of the field containing the token to be expired.
7. In the **Expiration** parameter, enter the number of minutes the token will live. The maximum allowed is 100.
8. Check the **Active** checkbox to activate the setting.

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-b4b92eb2c353553101c9e2c116e5d52bea084466%2FSecuredToken%20\(1\)%20\(1\).png?alt=media)

## Demo

A token of the SharinPix Album has been generated and inserted in the field 'token' as shown below:

{% hint style="success" %}
**Tip:**

Learn how to [generate tokens](https://docs.sharinpix.com/documentation/cookbook/generate-token-from-sharinpix-permission-with-apex) automatically.
{% endhint %}

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-5a05beef35c8bbd81844ea8b80d855d18869ed92%2Fto%20\(1\)%20\(1\).png?alt=media)

The picture below depicts a *SharinPix Album* in the *SharinPix Token Viewer* component:

![](https://2221230591-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5EvYRrLbUyvRh8o1jmMG%2Fuploads%2Fgit-blob-f26425c47af5374140c6827002f6dcd17a92f488%2FtokenViewer3%20\(1\)%20\(1\).png?alt=media)
