Class ShopperLogin<ConfigParameters>

Shopper Login and API Access Service

Enable shoppers to log in more easily, stay logged in for longer, and get a more fluid and personalized shopping experience powered by Shopper APIs.

Simple example:

  import { ShopperLogin } from "commerce-sdk-isomorphic";

const clientConfig = {
parameters: {
clientId: "XXXXXX",
organizationId: "XXXX",
shortCode: "XXX",
siteId: "XX"
}
};
const shopperLoginClient = new ShopperLogin(clientConfig);
API Version: 1.39.14
Last Updated:

Type Parameters

Hierarchy

  • ShopperLogin

Constructors

Methods

  • Logs in a shopper with credentials that are managed by a B2C Commerce instance (ECOM). It follows the authorization code grant flow as defined by the OAuth 2.1 standard. It also uses a proof key for code exchange (PKCE).

    For PKCE values:

    • The code_verifier string is a random string used for the /token endpoint request.
    • The code_challenge is an encoded version of the code_verifier string using an SHA-256 hash.

    The request must include a basic authorization header that contains a Base64 encoded version of the following string: \<shopperUserID\>:\<shopperPassword\>.

    Required parameters: code_challenge, channel_id, client_id, and redirect_uri.

    Optional parameters: `usid``.

    The SLAS /login endpoint redirects back to the redirect URI and returns an authorization code.

    Calls to /login made with the same loginId and tenantId within 1 second will result in a conflict.

    If you would like to get a raw Response object use the other authenticateCustomer function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: LoginRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<void>

    A promise of type void.

  • Logs in a shopper with credentials that are managed by a B2C Commerce instance (ECOM). It follows the authorization code grant flow as defined by the OAuth 2.1 standard. It also uses a proof key for code exchange (PKCE).

    For PKCE values:

    • The code_verifier string is a random string used for the /token endpoint request.
    • The code_challenge is an encoded version of the code_verifier string using an SHA-256 hash.

    The request must include a basic authorization header that contains a Base64 encoded version of the following string: \<shopperUserID\>:\<shopperPassword\>.

    Required parameters: code_challenge, channel_id, client_id, and redirect_uri.

    Optional parameters: `usid``.

    The SLAS /login endpoint redirects back to the redirect URI and returns an authorization code.

    Calls to /login made with the same loginId and tenantId within 1 second will result in a conflict.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: LoginRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

  • Get an authorization code after authenticating a user against an identity provider (IDP). This is the first step of the OAuth 2.1 authorization code flow, where a user can log in via federation to the IDP configured for the client. After successfully logging in, the user gets an authorization code via a redirect URI.

    This endpoint can be called from the front channel (the browser).

    If you would like to get a raw Response object use the other authorizeCustomer function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "usid" | "client_id" | "channel_id" | "hint" | "redirect_uri" | "response_type" | "scope" | "state" | "code_challenge"]: (Omit<{
                  channel_id?: string;
                  client_id: string;
                  code_challenge: string;
                  hint?: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
                  scope?: string;
                  state?: string;
                  usid?: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  client_id: string;
                  code_challenge: string;
                  hint?: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
                  scope?: string;
                  state?: string;
                  usid?: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<void>

    A promise of type void.

  • Get an authorization code after authenticating a user against an identity provider (IDP). This is the first step of the OAuth 2.1 authorization code flow, where a user can log in via federation to the IDP configured for the client. After successfully logging in, the user gets an authorization code via a redirect URI.

    This endpoint can be called from the front channel (the browser).

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "usid" | "client_id" | "channel_id" | "hint" | "redirect_uri" | "response_type" | "scope" | "state" | "code_challenge"]: (Omit<{
                  channel_id?: string;
                  client_id: string;
                  code_challenge: string;
                  hint?: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
                  scope?: string;
                  state?: string;
                  usid?: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  client_id: string;
                  code_challenge: string;
                  hint?: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
                  scope?: string;
                  state?: string;
                  usid?: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

  • Allows the customer to authenticate when their identity provider is down.

    If you would like to get a raw Response object use the other authorizePasswordlessCustomer function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordlessLoginRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Object>

    A promise of type Object.

  • Allows the customer to authenticate when their identity provider is down.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordlessLoginRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Object>

    A promise of type Response if rawResponse is true, a promise of type Object otherwise.

  • Get the shopper or guest JWT access token and a refresh token. This is the second step of the OAuth 2.1 authorization code flow.

    For a private client, an application is able to get an access token for the shopper through the back channel (a trusted server) by passing in the client credentials and the authorization code retrieved from the authorize endpoint.

    For a guest user, get the shopper JWT access token and a refresh token. This is where a client appplication is able to get an access token for the guest user through the back channel (a trusted server) by passing in the client credentials.

    For a public client using PKCE, an application will pass a PKCE code_verifier`` that matches the code_challenge`` that was used to authorize the customer along with the authorization code.

    When refreshing the access token with a private client ID and client secret, the refresh token is not regenerated. However, when refreshing the access token with a public client ID, the refresh token is always regenerated. The old refresh token is voided with every refresh call, so the refresh token on the client needs to be replaced to always store the new refresh token.

    See the Body section for required parameters, including grant_type and others, depending on the value of grant_type.

    Important*: We strongly recommended using the channel_id query parameter because it will be required in the future.

    If you would like to get a raw Response object use the other getAccessToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Get the shopper or guest JWT access token and a refresh token. This is the second step of the OAuth 2.1 authorization code flow.

    For a private client, an application is able to get an access token for the shopper through the back channel (a trusted server) by passing in the client credentials and the authorization code retrieved from the authorize endpoint.

    For a guest user, get the shopper JWT access token and a refresh token. This is where a client appplication is able to get an access token for the guest user through the back channel (a trusted server) by passing in the client credentials.

    For a public client using PKCE, an application will pass a PKCE code_verifier`` that matches the code_challenge`` that was used to authorize the customer along with the authorization code.

    When refreshing the access token with a private client ID and client secret, the refresh token is not regenerated. However, when refreshing the access token with a public client ID, the refresh token is always regenerated. The old refresh token is voided with every refresh call, so the refresh token on the client needs to be replaced to always store the new refresh token.

    See the Body section for required parameters, including grant_type and others, depending on the value of grant_type.

    Important*: We strongly recommended using the channel_id query parameter because it will be required in the future.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Returns a JSON Web Key Set (JWKS) containing the current, past, and future public keys. The key set enables clients to validate the Shopper JSON Web Token (JWT) issued by SLAS.

    If you would like to get a raw Response object use the other getJwksUri function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Object>

    A promise of type Object.

  • Returns a JSON Web Key Set (JWKS) containing the current, past, and future public keys. The key set enables clients to validate the Shopper JSON Web Token (JWT) issued by SLAS.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Object>

    A promise of type Response if rawResponse is true, a promise of type Object otherwise.

  • Issue a shopper token (JWT).

    If you would like to get a raw Response object use the other getPasswordLessAccessToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordLessLoginTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Issue a shopper token (JWT).

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordLessLoginTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Request a reset password token

    If you would like to get a raw Response object use the other getPasswordResetToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<void>

    A promise of type void.

  • Request a reset password token

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

  • Get a shopper JWT access token for a registered customer using session bridge.

    For public client id requests the grant_type must be set to session_bridge.

    For private client_id and secret the grant_type must be set to client_credentials along with a basic authorization header.

    If you would like to get a raw Response object use the other getSessionBridgeAccessToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: SessionBridgeTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Get a shopper JWT access token for a registered customer using session bridge.

    For public client id requests the grant_type must be set to session_bridge.

    For private client_id and secret the grant_type must be set to client_credentials along with a basic authorization header.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: SessionBridgeTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Get a shopper JWT access token for a registered customer using a trusted agent (merchant).

    If using a SLAS private client ID, you must also use an _sfdc_client_auth header.

    The value of the _sfdc_client_auth header must be a Base64-encoded string. The string is composed of a SLAS private client ID and client secret, separated by a colon (:). For example, privateClientId:privateClientsecret becomes cHJpdmF0ZUNsaWVudElkOnByaXZhdGVDbGllbnRzZWNyZXQ= after Base64 encoding.

    If you would like to get a raw Response object use the other getTrustedAgentAccessToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TrustedAgentTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Get a shopper JWT access token for a registered customer using a trusted agent (merchant).

    If using a SLAS private client ID, you must also use an _sfdc_client_auth header.

    The value of the _sfdc_client_auth header must be a Base64-encoded string. The string is composed of a SLAS private client ID and client secret, separated by a colon (:). For example, privateClientId:privateClientsecret becomes cHJpdmF0ZUNsaWVudElkOnByaXZhdGVDbGllbnRzZWNyZXQ= after Base64 encoding.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TrustedAgentTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Obtains a new agent on behalf authorization token for a registered customer.

    If you would like to get a raw Response object use the other getTrustedAgentAuthorizationToken function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "client_id" | "channel_id" | "redirect_uri" | "response_type" | "code_challenge" | "login_id" | "idp_origin"]: (Omit<{
                  channel_id: string;
                  client_id: string;
                  code_challenge: string;
                  idp_origin: string;
                  login_id: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id: string;
                  client_id: string;
                  code_challenge: string;
                  idp_origin: string;
                  login_id: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<void>

    A promise of type void.

  • Obtains a new agent on behalf authorization token for a registered customer.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "client_id" | "channel_id" | "redirect_uri" | "response_type" | "code_challenge" | "login_id" | "idp_origin"]: (Omit<{
                  channel_id: string;
                  client_id: string;
                  code_challenge: string;
                  idp_origin: string;
                  login_id: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id: string;
                  client_id: string;
                  code_challenge: string;
                  idp_origin: string;
                  login_id: string;
                  organizationId: string;
                  redirect_uri: string;
                  response_type: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

  • Get a shopper JWT access token for a registered customer whose credentials are stored using a third party system.

    For external trusted-system requests, a basic authorization header that includes a SLAS client ID and SLAS client secret can be used in place of the bearer token.

    For internal trusted-system requests, the bearer token must be a C2C JWT.

    If you would like to get a raw Response object use the other getTrustedSystemAccessToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TrustedSystemTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Get a shopper JWT access token for a registered customer whose credentials are stored using a third party system.

    For external trusted-system requests, a basic authorization header that includes a SLAS client ID and SLAS client secret can be used in place of the bearer token.

    For internal trusted-system requests, the bearer token must be a C2C JWT.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TrustedSystemTokenRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Returns a JSON listing of claims about the currently authenticated user.

    If you would like to get a raw Response object use the other getUserInfo function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "channel_id"]: (Omit<{
                  channel_id?: string;
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Object>

    A promise of type Object.

  • Returns a JSON listing of claims about the currently authenticated user.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "channel_id"]: (Omit<{
                  channel_id?: string;
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Object>

    A promise of type Response if rawResponse is true, a promise of type Object otherwise.

  • Returns a JSON listing of the OpenID/OAuth endpoints, supported scopes and claims, public keys used to sign the tokens, and other details.

    If you would like to get a raw Response object use the other getWellknownOpenidConfiguration function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Object>

    A promise of type Object.

  • Returns a JSON listing of the OpenID/OAuth endpoints, supported scopes and claims, public keys used to sign the tokens, and other details.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Object>

    A promise of type Response if rawResponse is true, a promise of type Object otherwise.

  • Returns the token properties. A basic auth header with Base64-encoded clientId:secret is required in the Authorization header, as well as an access token or refresh token. Use token_type_hint to help identify the token.

    If you would like to get a raw Response object use the other introspectToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Object>

    A promise of type Object.

  • Returns the token properties. A basic auth header with Base64-encoded clientId:secret is required in the Authorization header, as well as an access token or refresh token. Use token_type_hint to help identify the token.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Object>

    A promise of type Response if rawResponse is true, a promise of type Object otherwise.

  • Log out a shopper. The shopper's access token and refresh token are revoked. If the shopper authenticated with a B2C Commerce (ECOM) instance, the OCAPI JWT is also revoked. This should be called for Registered users that have logged in using SLAS. his should be called for registered users that have logged in using SLAS. This endpoint is not for use with guest users.

    Required header: Authorization header bearer token of the Shopper access token to logout.

    Required parameters: refresh token, channel_id, and client.

    If you would like to get a raw Response object use the other logoutCustomer function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "refresh_token" | "client_id" | "channel_id" | "hint"]: (Omit<{
                  channel_id?: string;
                  client_id: string;
                  hint?: string;
                  organizationId: string;
                  refresh_token: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  client_id: string;
                  hint?: string;
                  organizationId: string;
                  refresh_token: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Log out a shopper. The shopper's access token and refresh token are revoked. If the shopper authenticated with a B2C Commerce (ECOM) instance, the OCAPI JWT is also revoked. This should be called for Registered users that have logged in using SLAS. his should be called for registered users that have logged in using SLAS. This endpoint is not for use with guest users.

    Required header: Authorization header bearer token of the Shopper access token to logout.

    Required parameters: refresh token, channel_id, and client.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "refresh_token" | "client_id" | "channel_id" | "hint"]: (Omit<{
                  channel_id?: string;
                  client_id: string;
                  hint?: string;
                  organizationId: string;
                  refresh_token: string;
              }, keyof ConfigParameters> & Partial<{
                  channel_id?: string;
                  client_id: string;
                  hint?: string;
                  organizationId: string;
                  refresh_token: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

  • Creates a new password

    If you would like to get a raw Response object use the other resetPassword function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordActionVerifyRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<void>

    A promise of type void.

  • Creates a new password

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: PasswordActionVerifyRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

  • Get credential quality statistics for a user.

    If you would like to get a raw Response object use the other retrieveCredQualityUserInfo function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "username"]: (Omit<{
                  organizationId: string;
                  username: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
                  username: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<CredQualityUserResponse>

    A promise of type CredQualityUserResponse.

  • Get credential quality statistics for a user.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId" | "username"]: (Omit<{
                  organizationId: string;
                  username: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
                  username: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : CredQualityUserResponse>

    A promise of type Response if rawResponse is true, a promise of type CredQualityUserResponse otherwise.

  • Invalidate the refresh token. A basic auth header with Base64-encoded clientId:secret is required in the Authorization header, and the refresh token to be revoked is required in the body.

    If you would like to get a raw Response object use the other revokeToken function.

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<TokenResponse>

    A promise of type TokenResponse.

  • Invalidate the refresh token. A basic auth header with Base64-encoded clientId:secret is required in the Authorization header, and the refresh token to be revoked is required in the body.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: TokenActionRequest;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in "organizationId"]: (Omit<{
                  organizationId: string;
              }, keyof ConfigParameters> & Partial<{
                  organizationId: string;
              }>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : TokenResponse>

    A promise of type Response if rawResponse is true, a promise of type TokenResponse otherwise.

Properties

clientConfig: ClientConfig<ConfigParameters> & {
    baseUri: string;
}
defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/{version}" = "https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/{version}"