Perform the following steps to set up the guest user:

  1. Enable the Guest User functionality using the Organization Management User Interface of the following API: PATCH https://<URL_of_the_Instance>/api/user-management/v1/organization/info with the following minimum required sample payload:

    {  
      "GuestUserEnabled": true
    }
    CODE
  2. Create a guest user using the User Creation User Interface or the following API: POST https://<URL_of_the_Instance>/api/user-management/v1/user/guest.

    {
      "FirstName": "{FirstName}",
      "LastName": "{LastName}",
      "Email": "{}",
      "Alias": "guest",
    }
    CODE

    The guest user role and permission group are automatically added for the guest user. Administrators can update the GuestUserPermissionGroup to allow or amend permission for any custom object.

  3. Update the environment.ts > userId parameter with the guest user ID created in the first step and the loginEndpoint parameter with the authentication endpoint for the Guest User functionality.
  4. Create a configuration using the following API: POST https://<URL_of_the_Instance>/api​/config-management​/v1​/configurations with the following minimum required sample payload to whitelist the APIs that are not part of the out-of-the-box template and that you want to utilize with the guest user functionality:

    • You must pass the exact configuration category and configuration name that are available in the following payload.
    • The syntax pattern must be the same that is available in the following payload. For example, \"Route\":\"{endpoint}\",\"Method\":\"{API method that you want to allow}\"
    {
      "Category": "guestuser",
      "Name": "allowedroutes",
      "Value": "[{\"Route\":\"/api/catalog/v1/products\",\"Method\":\"GET\"},{\"Route\":\"\/api\/order\/v1\/orders\",\"Method\":\"GET\"},{\"Route\":\"\/api\/quote\/v1\/quotes\",\"Method\":\"GET\"},
              {\"Route\":\"\/api\/catalog\/v1\/products\/details\",\"Method\":\"POST\"},{\"Route\":\"\/api\/order\/v1\/order\/{ParentId}\/orderlineitems\",\"Method\":\"GET\"},
    		  {\"Route\":\"/api/revenue-admin/v1/storefronts/active\",\"Method\":\"GET\"},{\"Route\":\"/api/catalog/v1/price-lists/active\",\"Method\":\"GET\"},{\"Route\":\"/api/catalog/v1/search\",\"Method\":\"GET\"},
    		  {\"Route\":\"/api/catalog/v1/categories\",\"Method\":\"GET\"},{\"Route\":\"/api/revenue-admin/v1/accounts/active\",\"Method\":\"GET\"}, 
              {\"Route\":\"/api/revenue-admin/v1/flows/{flowname}/settings/{settingname}\",\"Method\":\"GET\"},{\"Route\":\"/api/catalog/v1/search\",\"Method\":\"POST\"},{\"Route\":\"/api/revenue-
              admin/v1/flows/{flowName}/views\",\"Method\":\"GET\"},{\"Route\":\"/api/revenue-admin/v1/flows/{flowname}/displays\",\"Method\":\"GET\"},{\"Route\":\"/api/order/v1/orders/{Id}\",\"Method\":\"GET\"},
              {\"Route\":\"/api/catalog/v1/products/compare\",\"Method\":\"POST\"},{\"Route\":\"/api/catalog/v1/products/{productId}\",\"Method\":\"GET\"},{\"Route\":\"/api/quote/v1/quotes/{Id}\",\"Method\":\"GET\"}]"
    }
    CODE

The guest user can now use the application according to the permissions granted to the guest user.

Refer to the following troubleshooting help for the guest user functionality:

Cause 1: The guest user is not created.

Cause 2: The guest user is created, but the guest user functionality is not enabled.

Cause 3: The guest user is created, and the guest user functionality is also enabled, but the environment.ts is not updated for the guest user parameters.

Resolution: Refer to the above steps (1 to 3) to set up the guest user.