---
title: "Sign visitors in to your help center"
description: "Let visitors sign in with the account they have in your product, through the Gleap SDK or single sign-on, and require sign-in for a customers-only help center."
url: https://help.gleap.ai/en/articles/16751994-sign-visitors-in-to-your-help-center
collection: "Help center"
updated: 2026-11-23
language: en
---

# Sign visitors in to your help center

Let visitors sign in with the account they have in your product, through the Gleap SDK or single sign-on, and require sign-in for a customers-only help center.

By default, anyone with the link can read your help center. Let visitors sign in with the account they already have in your product, and you can keep the whole help center for customers only, or show "Users only" articles to the right people. You need your own login page for this. The help center is available on the Team plan and up.

## Pick a sign-in method

1.  Go to **Settings → Help center → your site → General**.
    
2.  Under **Access**, choose an **Access method**: **Gleap SDK** or **Single sign-on**.
    
3.  Enter your **Login page**, for example https://app.yourdomain.com/login. **Sign in** on the help center sends visitors there.
    
4.  Add the code shown under **On your login page** to that page.
    

![Current help-center access methods in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/Dc94wAkC7NEc4HWLfxZ92djvsgwnOERiRmONBnY6EgrqyQ2JkUjgCqKDGA0JQj0Anox7XwXJmgP.png)

Which one to pick:

-   **Gleap SDK** fits when the Gleap SDK already runs in your web app. Your login page signs the user in with the SDK and hands their Gleap session to the help center.
    
-   **Single sign-on** needs no Gleap SDK on your login page. Your server signs a short token for the user, and the help center turns it into their session. It's the better choice when your login page is a server-rendered page or a separate auth app.
    

Both use an identity key from **Settings → Security → Customer identity → Identity keys**. Only admins can create one, and Gleap shows its secret once. Keep it on your server, never in the browser.

### How it works

When a visitor needs to sign in, the help center opens your login page with a `redirect` parameter: the help center address to send them back to. Once they're signed in, your page sends them back to that address with proof of who they are. Always check that the redirect points to your help center before you send anyone there. The code on the settings page lists your help center's addresses for that.

### When visitors get in on their own

If your help center runs on your own domain, for example help.yourdomain.com, and your app runs on the same domain, for example app.yourdomain.com, the help center can see who is signed in to your app. Visitors your app already signed in with the Gleap SDK get in without passing your login page. The settings page tells you which case applies to you, right above the code.

The code on your login page is still needed: it covers everyone else. That includes a help center on a gleap.help address, an app on a different domain, people coming from your mobile app, and apps that turned cookies off with `Gleap.setUseCookies(false)`.

## Gleap SDK

On your login page, once the user is signed in and the Gleap SDK is loaded:

```js
// token: an identity token your server signed for this user
await Gleap.setUserJwt(token);
const { gleapId, gleapHash, grant } = Gleap.getIdentity();

// Gleap sends visitors here with ?redirect=<help center URL>.
const back = new URL(new URLSearchParams(location.search).get('redirect'));
const helpCenterHosts = ['help.yourdomain.com'];
if (!helpCenterHosts.includes(back.host)) throw new Error('Unknown redirect');

// The session goes in the fragment: it never reaches a server log or another site.
const handover = new URL('/api/session', back.origin);
handover.searchParams.set('return', back.pathname + back.search);
const params = new URLSearchParams({ gleapId, gleapHash });
if (grant) params.set('grant', grant);
handover.hash = params.toString();
location.href = handover.toString();
```

The `token` comes from your server, signed with your identity key, as in [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md). The `grant` tells the help center that the sign-in was signed. A session without a grant counts as signed out, so nobody can read another user's content by claiming their user ID. Add `grant` only when it's set: `getIdentity()` returns `grant: null` when there is none, and passing "null" makes the sign-in fail.

Does your login page already send visitors back with `?gleapId=…&gleapHash=…` added to the redirect? That keeps working. The code above is the safer way: the session stays out of server logs and browser history.

## Single sign-on

Single sign-on uses an identity token, signed with your identity key. It's the same kind of token your app passes to `setUserJwt`, with two differences: it has `aud: "sso"`, and its `exp` is at most 10 minutes ahead. Sign a separate token for single sign-on, because `setUserJwt` refuses a token with `aud: "sso"`.

On your server, after the user signed in on your login page:

```js
import jwt from 'jsonwebtoken';

const token = jwt.sign(
  { userId: String(user.id), email: user.email, name: user.name, aud: 'sso' },
  process.env.GLEAP_IDENTITY_SECRET,
  { algorithm: 'HS256', keyid: process.env.GLEAP_IDENTITY_KEY_ID, expiresIn: '5m' },
);

// Gleap sends visitors here with ?redirect=<help center URL>.
const back = new URL(req.query.redirect);
const helpCenterHosts = ['help.yourdomain.com'];
if (!helpCenterHosts.includes(back.host)) throw new Error('Unknown redirect');
back.searchParams.set('gleapToken', token);
res.redirect(back.toString());
```

A token is valid for one sign-in. `userId` is required; `email` and `name` fill in the contact. Any library that signs HS256 JSON Web Tokens works, in any language: put the key ID in the `kid` header. Code for other server languages is in the developer guide [Customer identity](https://docs.gleap.ai/en/articles/709-enforce-identity-verification).

Sign-in always starts at the help center. A token your login page sends without the visitor coming from the help center first is refused, so nobody can sign someone else in with their own token.

## Require sign-in

With a sign-in method set, turn on **Require sign-in** and visitors must sign in before they can read anything:

-   **On the help center**, visitors who aren't signed in go straight to your login page, and come back to the page they wanted afterwards.
    
-   **In the Gleap widget**, the help center is hidden for visitors your app hasn't identified: no help center tab, no help center search on the home screen and no suggested articles. Identified users see everything as before.
    
-   **AI answers** in help center search need a sign-in too.
    
-   **Search engines** no longer find the help center: Gleap stops listing it in the sitemap and asks search engines not to index it.
    

Leave **Require sign-in** off if most of your content is public. Visitors then see a **Sign in** link in the help center header, and articles with the **Users only** audience filter show up for them once they sign in.

## Use a password instead

If you don't have a login page, choose **Password** as the **Access method** and set the **Password**. Visitors enter it before they can read anything, in the widget too. It's simple and fine for a closed beta, but a shared password is only as private as the least careful person who has it.

A password and sign-in don't combine: picking **Password** turns sign-in off, and picking **Gleap SDK** or **Single sign-on** removes the password. Gleap asks first either way.

### If sign-in doesn't work

If a visitor sees "Sign-in didn't work" after your login page, check these:

-   **Single sign-on:** the token was signed with an active identity key, has its key ID in the `kid` header, has `aud: "sso"`, an `exp` at most 10 minutes ahead and a `userId`, and was sent only once.
    
-   **Single sign-on:** the visitor started at the help center. Opening your login page directly and sending a token back doesn't work.
    
-   **Gleap SDK:** `Gleap.setUserJwt` finished before you read `Gleap.getIdentity()`, and the handover includes the `grant` when it's set, never the text "null". If the visitor is still a guest, the help center can't sign them in.
    
-   **Both:** the browser allows cookies for the help center.
    

If visitors bounce between the help center and your login page, your login page sends them back without the code above. That only works when the help center can see your app's sign-in on its own (see **When visitors get in on their own**).

If your code throws "Unknown redirect", add the help center address to the list in the code. After you connect a custom domain, copy the code from the settings page again: it lists both addresses.

### Make it public again

Choose **Public**. Gleap asks first, because it removes your login page from the settings, turns **Require sign-in** off and removes the **Sign in** link from the help center. If you used a password, it's removed too.

### Related

-   [Publish, brand and protect your help center](https://help.gleap.ai/en/articles/266-publish-brand-and-protect-your-help-center.md)
    
-   [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)
    
-   [Sign visitors in to the feedback portal](https://help.gleap.ai/en/articles/16751993-sign-visitors-in-to-the-feedback-portal.md)
