Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sleekplan.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Sleekplan’s Single Sign-On (SSO) lets users who already have accounts in your application log in to the feedback widget without a separate sign-up step. SSO is built on JSON Web Tokens (JWT), a standard for securely passing authentication data between systems. When a user performs an action that requires authentication — such as voting or submitting feedback — Sleekplan calls $sleek.sso, your server generates a signed token, and Sleekplan accepts it to authenticate the user instantly.

How it works

  1. A user performs an authenticated action (vote, submit feedback) in the widget.
  2. The JavaScript SDK calls $sleek.sso.
  3. Your server generates a JWT signed with your private SSO key.
  4. You pass the token back via the callback() parameter.
  5. Sleekplan verifies the token and logs the user in seamlessly.

1

Get your SSO secret key

Find your private SSO key in Settings → Developer inside the Sleekplan dashboard at https://app.sleekplan.com/settings/developer.
Your SSO secret key must only ever be used server-side. Never expose it in client-side JavaScript, public repositories, or environment variables that are shipped to the browser. Anyone who obtains the key can generate tokens for any user.
The SSO secret key is available on the Starter and Business plans.
2

Generate a JWT on your server

Use your language’s JWT library to create a token signed with HMAC SHA-256 (HS256). Replace PRIVATE_SSO_KEY with the key from the previous step. The localUser parameter in each example represents your application’s user record.
Install the library
npm install --save jsonwebtoken
Generate a token
const jwt = require('jsonwebtoken');

const key = 'PRIVATE_SSO_KEY';

function createSSOToken(localUser) {
    const userData = {
        // Required: email address used to uniquely identify the user
        mail: localUser.mail,
        // Recommended: your internal user ID
        id: localUser.id,
        // Optional: lowercase username, letters and numbers only
        name: localUser.name,
        // Optional: URL to the user's avatar image
        img: localUser.imgStr,
        // Optional: user weighting from 1-10 (e.g. based on MRR)
        weight: 4,
        // Optional: additional key-value pairs for the user profile
        meta: {
            companyName: localUser.cName,
        },
    };
    return jwt.sign(userData, key, { algorithm: 'HS256' });
}

JWT payload attributes

Sleekplan requires an email address to uniquely identify each user. All other attributes are optional but recommended.
AttributeRequiredDescription
mailYesEmail address of the user. Used as the primary identifier for the Sleekplan user record.
idNoYour internal user ID. Highly recommended — allows Sleekplan to match users even if their email address changes.
nameNoUsername. Use lowercase letters and numbers only — no spaces or special characters.
full_nameNoFull display name shown in the Sleekplan UI.
imgNoURL to the user’s avatar image.
weightNoUser weighting from 1 to 10 (e.g., based on MRR). Used for impact scoring on feedback items.
metaNoObject of additional key-value pairs stored on the user profile.
3

Authenticate the user with the token

Once you have a token, pass it to Sleekplan using the method that fits your integration type.
Set window.SLEEK_USER before the widget snippet loads. This is the simplest approach for server-rendered pages where the user is already authenticated when the page is served.
<!-- User token — place this BEFORE the widget snippet -->
<script type="text/javascript">
window.SLEEK_USER = {
    token: 'YOURTOKEN',
};
</script>

<!-- Sleekplan widget snippet -->
<script type="text/javascript">
window.$sleek = [];
window.SLEEK_PRODUCT_ID = YOUR_PRODUCT_ID;
(function() {
    d = document;
    s = d.createElement("script");
    s.src = "https://client.sleekplan.com/sdk/e.js";
    s.async = 1;
    d.getElementsByTagName("head")[0].appendChild(s);
})();
</script>
Place the window.SLEEK_USER block before the widget snippet. If the snippet loads first, it will not pick up the token.