Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStore
Security
Enabling refresh token on FastStore
Refresh token is a security mechanism that allows users to obtain a new, short-lived access token without requiring them to log in again.
The FastStore SDK Session includes built-in support for the refresh token flow. It automatically manages token renewal, session management, and error handling. As a FastStore user, you only need to enable the refresh token in your project configuration. The SDK will manage the process automatically, without requiring custom flow implementation.
In this guide, learn how to enable the refresh token in a FastStore store.
For background on how refresh tokens work, refer to the Refresh token flow for headless implementations guide.

Before you begin

Update your FastStore project

Make sure your project is updated to the latest version. To do so, follow these steps:
  1. Open your project in a code editor.
  2. Open a terminal and run the following command to update the FastStore packages to the latest version:

_10
yarn upgrade -L --scope @faststore

Request refresh token activation

Open a ticket with VTEX Support to request refresh token activation and an expiration time (1, 7, or 30 days). Include the account name(s) in your request to enable the feature. Without this activation, you won’t be able to enable the refresh token in your account.

Instructions

  1. Open your FastStore project in a code editor.
  2. In the discovery.config.js file, within the experimental section, add the refreshToken flag and set its value to true:
    discovery.config.js

    _10
    experimental: {
    _10
    _10
    refreshToken: true
    _10
    }

  3. Commit and push your changes to the main branch to deploy the changes to production.
Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
On this page