Skip to content

Commit f4e8e5a

Browse files
Merge branch 'main' into DEVDOCS-6340
2 parents 87c505c + bc0c37d commit f4e8e5a

File tree

31 files changed

+1068
-554
lines changed

31 files changed

+1068
-554
lines changed

docs/b2b-edition/authentication/hosted-auth.mdx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
---
2+
title: Authentication for hosted storefronts
3+
keywords: b2b edition, authentication, api token
4+
---
5+
16
# Authentication for hosted storefronts
27

38
<Callout type="important">
4-
As of September 30, 2025, the B2B Edition API `authToken` will be deprecated and replaced by the standard BigCommerce API `X-Auth-Token`.
9+
As of September 30, 2025, the B2B Edition API `authToken` is deprecated and replaced by the standard BigCommerce API `X-Auth-Token` used together with a new header `X-Store-Hash`. This change only applies to Server-to-Server requests. Storefront requests remain unchanged.
510

611
While `authToken` authentication is not expected to be fully sunset in the near future, it is advised to migrate to the new system as soon as possible to prevent disruption of functionality.
712

@@ -26,6 +31,10 @@ To create a token for server-to-server requests,
2631
3. Create a V3 Token with the B2B Edition scope set to `modify`.
2732
4. Save the relevant account keys for future reference.
2833

34+
<Callout type="info">
35+
If you are a partner building an app intended for use with B2B Edition, you will need to ensure the B2B Edition scope is enabled before publishing the app.
36+
</Callout>
37+
2938
For more information on creating and managing API accounts, refer to [API Accounts (Help Center)](https://support.bigcommerce.com/s/article/Store-API-Accounts).
3039

3140
<Callout type="warning">
@@ -45,13 +54,17 @@ An `X-Auth-Token` used without an `X-Store-Hash` or with a mismatched hash will
4554

4655
The `X-Auth-Token` structure is designed for long-term use. As such, they do not expire by default.
4756

48-
User-specific tokens can be generated by the [Get a Server to Server Token](/b2b-edition/apis/rest-management/authentication#get-server-to-server-tokens) endpoint, which generates a server-to-server token by validating a backend user’s login credentials and the store hash instead of relying on an existing token. This is useful if you are building an integration which automatically generates a token for Store Owner or Administrator users.
57+
User-specific tokens can be generated by the **deprecated** [Get a Server to Server Token](/b2b-edition/apis/rest-management/authentication#get-a-server-to-server-token) endpoint. Rather than relying on an existing token, it generates an `authToken` by validating a backend user’s login credentials and the store hash.
58+
59+
Server to server tokens can be configured to expire using this endpoint to set a fixed validity period using the `endAt` field in the request. For more information, see [Server-to-Server Authentication](/b2b-edition/apis/rest-management/authentication).
4960

5061
<Callout type= "warning">
51-
This endpoint does not support users with custom system user roles, even if those roles have API account creation permissions.
62+
This endpoint generates an `authToken`, which is deprecated. In addition, it does not support users with custom system user roles, even if those roles have API account creation permissions.
5263
</Callout>
5364

54-
Server to server tokens can be configured to expire using this endpoint to set a fixed validity period using the `endAt` field in the request. For more information, see (Server-to-Server Authentication)[/b2b-edition/apis/rest-management/authentication]
65+
<Callout type="info">
66+
If you are still using the B2B Edition specific `authToken`, the store hash is not needed as the token includes that information. Including `X-Store-Hash` with `authToken` will have unexpected results. Please migrate to the unified token structure as soon as possible to avoid loss of functionality.
67+
</Callout>
5568

5669
```js filename="Fetch request example" copy
5770
async function() {
@@ -77,14 +90,12 @@ async function() {
7790
}
7891
```
7992

80-
Tokens created via API can be invalidated as necessary using the [Delete Backend API Tokens](/b2b-edition/apis/rest-management/authentication#delete-backend-api-tokens) endpoint.
81-
82-
For more details, see the [B2B Edition Settings](https://support.bigcommerce.com/s/article/B2B-Edition-Settings).
93+
Tokens created via API can be invalidated as necessary using the **deprecated** [Delete Backend API Tokens](/b2b-edition/apis/rest-management/authentication#delete-backend-api-tokens) endpoint.
8394

8495
## Storefront Tokens
8596

8697
<Callout type= "info">
87-
**Note:** This section covers authentication for the B2B Edition GraphQL Storefront API. It is best practice to use GraphQL mutations when generating storefront authTokens on B2B Edition’s Buyer Portal experience. For information about the equivalent REST Storefront Authentication API requests, see [Authentication](/b2b-edition/apis/rest-storefront/sales-rep).
98+
**Note:** This section covers authentication for the B2B Edition GraphQL Storefront API. It is best practice to use GraphQL mutations when generating storefront authTokens on B2B Edition’s Buyer Portal experience. For information about the equivalent REST Storefront Authentication API requests, see [Authentication](/b2b-edition/apis/rest-storefront/authentication).
8899
</Callout>
89100

90101
B2B Edition’s REST Storefront and GraphQL Storefront APIs allow you to query and modify data from the context of a storefront user. Depending on your store’s configurations, you can perform certain actions as a guest shopper, a B2C customer with a storefront account, a B2B buyer with a Company user account, or a [Super Admin](/b2b-edition/apis/rest-storefront/sales-rep) user.
@@ -183,7 +194,7 @@ const options = {
183194
headers: {Accept: 'application/json', 'Content-Type': 'application/json'}
184195
};
185196

186-
fetch('https://mybcstore.com/customer/current.jwt?$app_client_id=dl7c39mdpul6hyc489yk0vzxl6jesyx', options)
197+
fetch('https://mybcstore.com/customer/current.jwt?app_client_id=dl7c39mdpul6hyc489yk0vzxl6jesyx', options)
187198
.then(response => response.json())
188199
.then(response => console.log(response))
189200
.catch(err => console.error(err));
@@ -230,7 +241,7 @@ mutation userAuth(
230241

231242
See our article on [storefront authentication](/b2b-edition/apis/rest-storefront/authentication#get-storefront-authtoken-within-stencil) to learn more about this mutation’s usage and fields.
232243

233-
### Rest Management API Endpoints
244+
### REST Management API Endpoints
234245

235246
If your integration or headless solution is built to use server-side endpoints, you can also retrieve storefront authTokens via B2B Edition’s REST Management Authentication API. Each endpoint uses a server to server authToken for validation, but they also require specific fields or parameters based on their use case.
236247

@@ -288,4 +299,3 @@ async function() {
288299
* [Authentication](/b2b-edition/apis/rest-storefront/authentication) (Storefront)
289300
* [Current Customer](/docs/storefront-auth/current-customer)
290301
* [Authenticating requests to the GraphQL Storefront API](/docs/start/authentication/graphql-storefront)
291-

docs/b2b-edition/specs/api-v3/address/address.yaml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ tags:
2222
- name: Addresses
2323
security:
2424
- X-Auth-Token: []
25+
X-Store-Hash: []
2526
paths:
2627
/countries:
27-
parameters:
28-
- $ref: "#/components/parameters/X-Store-Hash"
2928
get:
3029
summary: Get a Country
3130
tags:
@@ -121,8 +120,6 @@ paths:
121120
meta:
122121
message: Resource not found
123122
/states:
124-
parameters:
125-
- $ref: "#/components/parameters/X-Store-Hash"
126123
get:
127124
summary: Get a State
128125
tags:
@@ -395,8 +392,6 @@ paths:
395392
- code
396393
- data
397394
- meta
398-
parameters:
399-
- $ref: "#/components/parameters/X-Store-Hash"
400395
post:
401396
summary: Create a Company Address
402397
operationId: post-companies-companyId-addresses
@@ -515,7 +510,6 @@ paths:
515510
message: "Parameter Error"
516511
'/addresses/{addressId}':
517512
parameters:
518-
- $ref: "#/components/parameters/X-Store-Hash"
519513
- schema:
520514
type: string
521515
name: addressId
@@ -652,8 +646,6 @@ paths:
652646
schema:
653647
$ref: '#/components/schemas/responseNotFound'
654648
/addresses/bulk:
655-
parameters:
656-
- $ref: "#/components/parameters/X-Store-Hash"
657649
post:
658650
summary: Bulk Create Addresses
659651
operationId: post-addresses
@@ -887,8 +879,6 @@ paths:
887879
meta:
888880
message: "Parameter Error"
889881
/addresses/extra-fields:
890-
parameters:
891-
- $ref: "#/components/parameters/X-Store-Hash"
892882
get:
893883
summary: Get Address Extra Field Configs
894884
tags:
@@ -988,14 +978,6 @@ paths:
988978
- meta
989979
components:
990980
parameters:
991-
X-Store-Hash:
992-
name: X-Store-Hash
993-
in: header
994-
required: true
995-
schema:
996-
type: string
997-
example: abc123
998-
description: The unique store hash associated with a BigCommerce store that has B2B Edition enabled.
999981
limit:
1000982
name: limit
1001983
in: query
@@ -1305,6 +1287,16 @@ components:
13051287
- data
13061288
- meta
13071289
securitySchemes:
1290+
X-Store-Hash:
1291+
name: X-Store-Hash
1292+
description: |-
1293+
### Authentication header
1294+
1295+
| Header | Argument | Description |
1296+
|:-------|:---------|:------------|
1297+
| `X-Store-Hash` | `store_hash` | The unique store hash associated with a BigCommerce store that has B2B Edition enabled. |
1298+
type: apiKey
1299+
in: header
13081300
X-Auth-Token:
13091301
name: X-Auth-Token
13101302
description: |-

0 commit comments

Comments
 (0)