User Management for Sites

Organize and control user access across your site.

Site user management allows administrators and developers to control who can access gated sites within the platform. Access is managed through users, groups, and site assignments, making it easy to grant permissions at scale.

Setting Up Access to a Private Site

Step 1: Navigate to Site Access Management

In the Developer tab, select Manage Access on the Gated Site Access card.

Step 2: Create a User

In the UI, click on Create User. Fill out the following user details:

  • Email - required
  • Password - required
  • First Name
  • Last Name
  • Company
  • Company ID
  • External User D
  • Phone Number
  • Locale
Notion image

Click “Save” to create the user.

Step 3: Create a Group

On the Groups tab, click Create Group, then enter the group’s name and description. Click “Save” to complete the process.

Notion image

Step 4: Add the User to the Group

Select the group in the list and click Add User. In the dropdown, search for or choose the user, then click “Assign” to finish.

Notion image

Step 5: Associate the Protected Site with the Group

With the group selected, click “Assign Website”. In the dropdown, search for or select the website, then click “Assign” to finish.

Notion image
Notion image

Once these steps are complete, users can access the protected site.

 

Endpoints for Portal Authentication

Certain authentication endpoints are available for use during portal development. These endpoints are served from the root of the hosted site’s domain.

Login Page

Serves the HTML login page where users enter their credentials.

GET /auth/login

As a portal developer, you can redirect unauthenticated users to this endpoint but no additional implementation is required. The login form submission and authentication are management automatically server-side.

Portal Logout

Logs out the currently authenticated user and ends their session.

GET /auth/logout

Use this endpoint in code or button components as a logout link in your portal. When accessed, the user’s session will be terminated.

<!-- example of usage in a link -->
<a href="/auth/logout">Sign Out</a>

Get Current User

Returns the details of the currently authenticated user.

GET /auth/me

Response

Field
Description
companyId
The identifier of the user's company
companyName
The name of the user's company
email
The user's email address
firstName
The user's first name
groups
Array of groups the user belongs to (that are linked to this site)
lastName
The user's last name
locale
The user's locale preference
phoneNumber
The user's phone number
siteId
The identifier of the current site
userId
The unique identifier of the user
username
The user's username
{
  "companyId": "string",
  "companyName": "string",
  "email": "string",
  "firstName": "string",
  "groups": [
    {
      "id": "string",
      "name": "string"
    }
  ],
  "lastName": "string",
  "locale": "string",
  "phoneNumber": "string",
  "siteId": "string",
  "userId": "string",
  "username": "string"
}
// usage example
async function loadUserData() {
  let requestURL = "/auth/me";
  let headers = {
    Accept: "application/json",
  };

  try {
    const response = await fetch(requestURL, {
      method: "GET",
      headers: headers,
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const userData = await response.json();
    // process the data as needed
    renderContent(userData);
  } catch (error) {
    contentDiv.innerHTML = `<div class="error"><strong>Error loading user data:</strong> ${error.message}</div>`;
  }
}
 

When the /auth/me endpoint is used in the context of site builder, it returns dummy data that includes all groups linked to the site. This allows portal developers to test group-based conditional logic without needing to log in as an actual site user. This is useful when building features that depend on group membership, such as:

  • Showing or hiding content based on user groups
  • Enabling features for specific user groups
  • Testing different use permission scenarios
 
Did this answer your question?
😞
😐
🤩