Comments (14)
@RayeEThompson How does the Vercel CLI help me getting the right credentials? It will only store and receive credentials. But it won't magically generate them. Or am I wrong here? 🤔
This is my personal story. The needed data:
BIGCOMMERCE_STOREFRONT_API_URL=<>
BIGCOMMERCE_STOREFRONT_API_TOKEN=<>
BIGCOMMERCE_STORE_API_URL=<>
BIGCOMMERCE_STORE_API_TOKEN=<>
BIGCOMMERCE_STORE_API_CLIENT_ID=<>
I searched the whole BigCommerce docs but could only finde that I can obtain the following data from the BigCommerce dashboard:
- Client Secret
- Client ID
- Access Token
- API Path
This is documented here: BigCommerce Docs
I would derive the following mapping:
- BIGCOMMERCE_STORE_API_TOKEN = Access Token
- BIGCOMMERCE_STORE_API_CLIENT_ID = Client ID
- BIGCOMMERCE_STORE_API_URL = API Path
For the storefront itself there are no credentials:
The Storefront API is unauthenticated, allowing you to make client-side requests for carts, checkouts, and orders using JavaScript.
Source
But, there are so called Storefront GraphQL credentials. To use them I need to create a JWT like explained here. So I would suppose that this is the BIGCOMMERCE_STOREFRONT_API_TOKEN. The BIGCOMMERCE_STOREFRONT_API_URL is the URL I see in the BigCommerce dashboard when I click on "View Store".
I'll try this now. Would be awesome if you could add the table below or any further information to the readme. ❤️
Variable | Example | Source |
---|---|---|
BIGCOMMERCE_STOREFRONT_API_URL | https://store-{STORE_ID}.mybigcommerce.com/graphql | BigCommerce dashboard, "View Store" |
BIGCOMMERCE_STOREFRONT_API_TOKEN | iyK2eXAiXiJKV1QiLCJhbGciOiJFUzI1NiJ... | Should be generated: BigCommerce Docs |
BIGCOMMERCE_STORE_API_URL | https://api.bigcommerce.com/stores/{STORE_ID} | BigCommerce dashboard, visible during the "Create API Account" process |
BIGCOMMERCE_STORE_API_TOKEN | iyK2eXAiXiJKV1QiLCJhbGciOiJFUzI1NiJ... | BigCommerce dashboard, visible after the "Create API Account" process |
BIGCOMMERCE_STORE_API_CLIENT_ID | iyK2eXAiXiJKV1QiLCJhbGciOiJFUzI1NiJ... | BigCommerce dashboard, visible afterthe "Create API Account" process |
Edit: Added /graphql to BIGCOMMERCE_STOREFRONT_API_URL
Edit: Removed /v3 from BIGCOMMERCE_STORE_API_URL
from commerce.
Also for anyone willing to contribute, making it mandatory to sign up BigCommerce may actually discourage potential contributors.
from commerce.
@okbel for the new contributor~, how they know the proper values? Where can we get the API and Token~?
from commerce.
It should be as below:
BIGCOMMERCE_STOREFRONT_API_URL=https://store-${STORE_ID}.mybigcommerce.com/graphql
BIGCOMMERCE_STOREFRONT_API_TOKEN=${STOREFRONT_TOKEN}
BIGCOMMERCE_STORE_API_URL=https://api.bigcommerce.com/stores/${STORE_ID}
BIGCOMMERCE_STORE_API_TOKEN=${STORE_TOKEN}
BIGCOMMERCE_STORE_API_CLIENT_ID=${STORE_CLIENT}
With:
STORE_ID: you can get it from your bigcommerce dashboard URL,
STOREFRONT_TOKEN: easy way to get it is to go to Advanced Settings > Storefront API Playground and then pick the storefront_token from URL,
STORE_TOKEN|STORE_CLIENT: go to Advanced Settings > API Accounts then create a V2/V3 API Token.
from commerce.
Can anybody tell me where the env values are actually being used/called in the code?
They're being used in the @bigcommerce/storefront-data-hooks node module: node_modules@bigcommerce\storefront-data-hooks\api\index.js
from commerce.
It should be as below:
BIGCOMMERCE_STOREFRONT_API_URL=https://store-${STORE_ID}.mybigcommerce.com/graphql
BIGCOMMERCE_STOREFRONT_API_TOKEN=${STOREFRONT_TOKEN}
BIGCOMMERCE_STORE_API_URL=https://api.bigcommerce.com/stores/${STORE_ID}
BIGCOMMERCE_STORE_API_TOKEN=${STORE_TOKEN}
BIGCOMMERCE_STORE_API_CLIENT_ID=${STORE_CLIENT}With:
STORE_ID: you can get it from your bigcommerce dashboard URL,
STOREFRONT_TOKEN: easy way to get it is to go to Advanced Settings > Storefront API Playground and then pick the storefront_token from URL,
STORE_TOKEN|STORE_CLIENT: go to Advanced Settings > API Accounts then create a V2/V3 API Token.
@BilalDev Thanks.
✅ My auth only works with the store token + store id version of the BIGCOMMERCE_STOREFRONT_API_URL
e.g.
BIGCOMMERCE_STOREFRONT_API_URL=https://store-${STORE_TOKEN}-${STORE_ID}.mybigcommerce.com/graphql
🚫 These storefront api urls do not work with my generated API creds + storefront token:
https://${STORE_NAME}.mybigcommerce.com/graphql
https://store-${STORE_ID}.mybigcommerce.com/graphql
Hope this helps!
from commerce.
Hey @jpatters! I'm sorry you struggled to much to get this working! We updated our README a couple of days ago. Have you tried that? Pulling the env vars? LMK! And thanks for the feedback!
@thesobercoder We're currently working on supporting more data providers so stay tuned!
from commerce.
@okbel for the new contributor~, how they know the proper values? Where can we get the API and Token~?
Have you managed to figure out yet?
from commerce.
@David05500 Yeah.. any tips?
from commerce.
@David05500 Yeah.. any tips?
Unfortunately I am looking for the answer myself!
from commerce.
In BigCommerce you can get the API tokens from the Store's control panel - you can refer to our documentation on authentication here: https://developer.bigcommerce.com/api-docs/getting-started/authentication/rest-api-authentication
You will also need a graphql auth token: https://developer.bigcommerce.com/api-reference/store-management/tokens/api-token/createtoken
The easiest way to connect however, is to use the Vercel CLI and pull your .env.local. This is part of the native integration ;)
from commerce.
You will need to use the Vercel CLI and use the cmd for pull .env.local, as long as you used the native integration.
The Storefront API URL should contain the /graphql endpoint. Everything else looks correct.
from commerce.
Can anybody tell me where the env values are actually being used/called in the code?
from commerce.
Correct. Thank you!
from commerce.
Related Issues (20)
- How to add product metafield data HOT 2
- Proceeding to checkout gives 500 [GET] /cart/c/c1-abcd?key=1234 status=500 HOT 6
- View Page/Product always gives 500 HOT 3
- getCollectionProducts always get 500, SocketError: other side closed
- Slow loading of images on product page HOT 2
- Code for Cart Discount
- Implementation of Shopify analytics HOT 1
- Products not showing in category page
- Hidden: Homepage Featured Items not reflecting on live site HOT 2
- Error in Add to Cart and Edit Cart Form HOT 1
- sitemap.xml & robots.txt points to Vercel's domain HOT 1
- Error cloning and deploying
- Vercel Deploy fails to build
- build erros HOT 1
- Feature: Customer Accounts HOT 1
- Performance levers around router.push and Suspense HOT 5
- Can't install cross-env due to some eslint peerDeps errors in `npm i -D cross-env` HOT 1
- Broken docs link HOT 1
- Checkout redirects from custom domain to shopify domain HOT 1
- How can I remove shopify integration completely?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commerce.