Skip to content

Commit 761ca3b

Browse files
committed
fix: B2B-3725 add required b2b headers
1 parent 5c73ac0 commit 761ca3b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/b2b/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const ENV = z
1414
env: z.object({
1515
B2B_API_TOKEN: z.string(),
1616
BIGCOMMERCE_CHANNEL_ID: z.string(),
17+
BIGCOMMERCE_STORE_HASH: z.string(),
1718
}),
1819
})
1920
.transform(({ env }) => env);
@@ -29,7 +30,7 @@ const B2BTokenResponseSchema = z.object({
2930
});
3031

3132
export async function loginWithB2B({ customerId, customerAccessToken }: LoginWithB2BParams) {
32-
const { B2B_API_TOKEN, BIGCOMMERCE_CHANNEL_ID } = ENV.parse(process);
33+
const { B2B_API_TOKEN, BIGCOMMERCE_CHANNEL_ID, BIGCOMMERCE_STORE_HASH } = ENV.parse(process);
3334

3435
const apiHost = getAPIHostname();
3536

@@ -39,6 +40,8 @@ export async function loginWithB2B({ customerId, customerAccessToken }: LoginWit
3940
Accept: 'application/json',
4041
'Content-Type': 'application/json',
4142
authToken: B2B_API_TOKEN,
43+
'X-Store-Hash': BIGCOMMERCE_STORE_HASH,
44+
'X-Auth-Token': B2B_API_TOKEN,
4245
},
4346
body: JSON.stringify({
4447
channelId: BIGCOMMERCE_CHANNEL_ID,

0 commit comments

Comments
 (0)