Detected country: US
logo
Open AppStatusSubmit Ticket
GuideAPI References
‌
‌
‌
logo

Powered by

  • Home
  • Distribution
  • Help Center
  • Authenticated help centers

Authenticated help centers

1min read

Share

Authenticated help centers let you gate access to your Brainfish-hosted Help Center so only signed-in users from your application can view it. Brainfish supports this via JWT tokens configured on your Help Center Agent.

How it works

  1. Your application authenticates the user and issues a JWT signed with a shared secret.
  2. The Brainfish Help Center page calls your authentication endpoint to verify the user is signed in (cookie-based) or accepts the JWT directly.
  3. Brainfish validates the JWT against the secret you've configured and serves help center content only if validation succeeds.

Configure JWT authentication in Brainfish

  1. Open the Distribution tab, then choose your Help Center agent.
  2. Scroll to Advanced Settings and expand it.
  3. Under Authentication, paste your JWT shared secret. Save changes.

Once that's saved, your Help Center will require a valid JWT (or a valid authenticated session, depending on how you wire it up) before serving content.

Example: checking authentication via a cookie

Below is a sample fetch you can add to your help center page (or your application shell) to check whether the user is authenticated using a cookie issued by your own application:

// Replace this URL with your authentication API endpoint
const authApiUrl = "https://your-auth-api.com/is-authenticated";

function checkUserAuthentication() {
  fetch(authApiUrl, {
    method: "GET",
    credentials: "include" // send cookies along with the request
  })
    .then((response) => {
      if (response.ok) return response.json();
      throw new Error("Error fetching authentication status");
    })
    .then((data) => {
      if (data.isAuthenticated) {
        console.log("User is authenticated");
      } else {
        console.log("User is not authenticated");
      }
    })
    .catch((error) => {
      console.error("Error:", error);
    });
}

checkUserAuthentication();

Replace authApiUrl with your own authentication API endpoint. The endpoint should read the user's session cookie and return a JSON body like { "isAuthenticated": true }. With credentials: "include", the fetch sends cookies along with the request so your endpoint can verify the session.

Related articles

  • How to Set Up Multiple Help Centers in Brainfish
  • Customising Brainfish for Your Brand

Share