Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
✨ New Example: SPA Authentication with Vite and Local Storage
This PR introduces a new example application,
spa-authentication
, demonstrating client-side authentication with Elastic Path Commerce Cloud using local storage in a Single Page Application (SPA) context. The application is built with React and Vite.Key Features & Changes:
examples/spa-authentication
):StorefrontProvider.tsx
):authentication-local-storage
example.localStorage
./oauth/access_token
endpoint.import.meta.env.VITE_APP_...
) for configuration.App.tsx
):@epcc-sdk/sdks-shopper
.examples/spa-authentication/README.md
):authentication-local-storage
README but tailored for this Vite SPA..env.example
file and instructions for configuring necessary EPCC credentials (Client ID and Endpoint URL).@epcc-sdk/sdks-shopper
to thespa-authentication
project's dependencies.Purpose:
This example serves as a guide for developers looking to implement storefront authentication in a modern SPA stack using Vite and React, leveraging local storage for token management. It highlights how to use the EPCC SDK for authentication and data fetching in such an environment, while also pointing out important security considerations.
How to Test:
examples/spa-authentication
.examples/spa-authentication
..env
file from.env.example
and populate it with your EPCC credentials.pnpm install
(ornpm install
/yarn install
).pnpm dev
(ornpm run dev
/yarn dev
).Issue ticket number and link
n/a
Checklist before requesting a review