1. Authentication

Anonymous shopping

Overview

Anonymous shopping, also known as guest checkout, enables users to browse products and complete purchases without registration. This feature requires specific platform configuration to ensure proper data access and security controls.

Application configuration

Anonymous shopping requires a default context user to establish data access permissions. This configuration determines what product and pricing information anonymous users can view.

Configuration steps

  1. Create an active buyer user.
  2. Configure API client settings:
    • Access the API console in your OrderCloud tenant
    • Navigate to API Clients
    • GET a list of API clients and find the one with Buyer Access
  1. Set default context:
    • Locate the "Default Context User Name" section
    • Add the appropriate buyer user name
    • This user's security and assignments apply to all anonymous users
  1. Enable anonymous access:
    • Locate the "Is Anon Buyer" setting
    • Toggle the setting on

Anonymous authentication

After configuring the default context user, implement anonymous authentication using the Client Credentials grant type:

http
POST sandboxapi.ordercloud.io/oauth/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded

client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&scope=ProductReader CategoryReader MeAddressAdmin MeCreditCardAdmin&grant_type=client_credentials

The system returns a standard OAuth response containing an access token for the anonymous session.

Authentication notes

  • Token duration: 7-60 days (configurable)
  • API Client token duration settings do not affect anonymous users
  • Refresh tokens are not available for anonymous users
  • Order submission is possible with anonymous tokens
  • Historical order access requires user profiling

User profiling implementation

User profiling enables order history tracking and personalized experiences. Profile creation can occur before or after order creation, with order data automatically transferring to the new profile.

Profiling request

Use the Register an anonymous user endpoint:

http
PUT https://api.ordercloud.io/v1/me/register?anonUserToken=eyJ0eXAi0iJKV1QiLCJhbGci0iJ9... HTTP/1.1
Authorization: Bearer eyJ0eXAi0iJKV1QiLCJhbGci0iJ9...
Content-Type: application/json
json
{
  "ID": "NewUserName",
  "Username": "MyUserName",
  "FirstName": "John",
  "LastName": "Doe",
  "Email": "[email protected]",
  "Phone": "555-555-5555",
  "TermsAccepted": true,
  "Active": true,
  "xp": null
}

Post-profiling steps

  1. System returns new access token
  2. Remove anonymous access token
  3. Continue operations with profiled user token
  4. Access order history and personalized features
If you have suggestions for improving this article, let us know!