REST authentication flow

REST services are authenticated in HCL Commerce on secure and unsecured channels.
The following diagram shows the REST authentication flow for the REST and Web clients:
REST authentication flow
Where:
If the call is on a secure channel:
  1. If the WCTrustedToken header is present, use the WCTrustedToken header.
  2. If the WC_AUTHENTICATION_* cookie is present and cookie usage is allowed for REST, use the WC_AUTHENTICATION_* cookie matching the specified store ID.
  3. If the WC_PERSISTENT cookie is present and cookie usage is allowed for REST, use the WC_PERSISTENT cookie if persistent sessions are enabled for the service. Otherwise, an exception is thrown indicating that partial authentication is not allowed.
If the call is on an unsecure channel:
  1. If the WCToken header is present, use the WCToken header.
  2. If the WC_USERACTIVITY_* cookie is present and cookie usage is allowed for REST, use the WC_USERACTIVITY_* cookie matching the specified store ID. Then, set the WC_USERACTIVITY_* cookie in the response with an updated timeout value, only if the expiration is within the configured threshold to avoid updates on every request.
  3. If the WC_PERSISTENT cookie is present and cookie usage is allowed for REST, use the WC_PERSISTENT cookie if persistent sessions are enabled for the service. Otherwise, an exception is thrown indicating that partial authentication is not allowed.
Note: it is recommended to use cookies for authentication, so that persistent sessions are enabled for shoppers to be remembered. For more information, see Enabling partial authentication and cookie-based authentication for REST services.