When building single-click BigCommerce apps, the @gadgetinc/react-bigcommerce package provides the following features:
Handles OAuth and access_token flow required for single-click BigCommerce apps
Manages user sessions in the session model using an iframe-secure session with the Gadget backend
Installation
For Gadget apps that have a BigCommerce connection, the @gadgetinc/react-bigcommerce package is automatically installed.
If you need to install the package manually, you can do so with yarn:
session-sh
yarn add @gadgetinc/react-bigcommerce
Package manager support
Gadget apps use yarn as the package manager.
If you are adding @gadgetinc/react-bigcommerce to a non-Gadget app, you can use the package manager of your choice.
Usage
To use @gadgetinc/react-bigcommerce in your app, you can import the <Provider /> and pass in your Gadget app API client as a prop. A useGadget() hook can be used to check when the OAuth request is loading and if the user isAuthenticated.