For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
      • Overview
      • Storefront
          • Authentication
            • POSTGet Storefront authToken Within Stencil
            • POSTGet Storefront authToken for Specific Customer
          • Catalog
          • Company
          • Orders
          • Request for Quote
          • Sales Rep
          • Shopping List
          • Store Settings
      • Management
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTB2BStorefrontAuthentication

Get Storefront authToken Within Stencil

POST
https://api-b2b.bigcommerce.com/api/v2/login
POST
/api/v2/login
$curl -X POST https://api-b2b.bigcommerce.com/api/v2/login \
> -H "Content-Type: application/json" \
> -d '{
> "bcToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY"
>}'
200Successful
1{
2 "code": 200,
3 "data": {
4 "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY"
5 },
6 "message": "SUCCESS"
7}
Uses a [JSON web token](/developer/docs/storefront/guides/customer-authentication/current-customer) (JWT) from a particular customer or Company user who is currently logged in to the storefront to create a storefront authToken for future requests. To learn more about how you can retrieve a JWT to create a storefront authToken. See [Authentication for hosted storefronts](/developer/docs/b2b-edition/getting-started/authentication). Equivalent Storefront GraphQL API Mutation: `authorization`. ### Example GraphQL API Body ``` graphQL copy mutation { authorization( authData: { bcToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY", channelId: 1 } ) { result { token } } } ``` ### Example GraphQL API Response ``` json copy { "data": { "authorization": { "result": { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY" } } } } ```
Was this page helpful?
Previous

Authentication

Next

Get Storefront authToken for Specific Customer

Built with

Uses a JSON web token (JWT) from a particular customer or Company user who is currently logged in to the storefront to create a storefront authToken for future requests.

To learn more about how you can retrieve a JWT to create a storefront authToken. See Authentication for hosted storefronts.

Equivalent Storefront GraphQL API Mutation: authorization.

Example GraphQL API Body

copy
1mutation {
2 authorization(
3 authData: {
4 bcToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY",
5 channelId: 1
6 }
7 ) {
8 result {
9 token
10 }
11 }
12}

Example GraphQL API Response

copy
1{
2 "data": {
3 "authorization": {
4 "result": {
5 "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImtpZG8yNzZAc25hcG1haWwuY2MiLCJzdG9yZV9oYXNoIjoiMWk2enB4cGUzZyIsImRiIjoiZGVmYXVsdCIsIm5hbWUiOiJ0ZXN0OSIsImNoYW5uZWxfaWRzIjpbMV0sInRva2VuX3R5cGUiOjMsIm5iZiI6MTAwMCwiZXhwIjoyMDAxfQ.EiR__LVAlBVNYtFCZPWJYoPv6UfGiXtULxhK-BCQZjY"
6 }
7 }
8 }
9}

Request

This endpoint expects an object.
bcTokenstringRequired

The JSON Web Token (JWT) obtained from a signed-in Company user. See Current Customer API to learn how to request a JWT.

storeHashstringOptional
The unique store hash for the BigCommerce store.
channelIddoubleOptionalDefaults to 1

The storefront channel ID associated with the storefront login session. Use 1 for your store’s default storefront channel.

customerIdintegerOptional
The BigCommerce customer ID associated with a Company user.

Response

OK
codedoubleDefaults to 200
dataobject
messagestring