Skip to main content

Single Sign-On (SSO) for Your Ideas Portal

How to sign customers in to your Ideas Portal with your own app's login, using a JSON Web Token (JWT), and how to block anonymous visitors.

Written by Jon

By default, anyone with your Ideas Portal's URL can view it. Portal SSO signs customers in using your own app's login, so their name and email come through automatically, and you can hide the portal from anyone who isn't signed in.

This is SSO for your customers visiting the Ideas Portal.

To set up SSO for your team logging in to Userback, see Single Sign-On (SSO).

Set up portal SSO

1. Copy your private key

Open Portal Settings and go to the Single Sign-On tab. Copy the Private Key. Keep it secret and only use it on your server.

2. Generate an SSO token on your server

Use a JWT library to sign a token with your private key. The token carries the user's email, name, and avatar URL. For example, in Node.js:

const jwt = require('jsonwebtoken');  // Replace with your private key const private_key = 'YOUR_PRIVATE_SSO_KEY';  // Replace with the signed-in user's details const sso_token = jwt.sign({   email: 'user@example.com',   name: 'John Doe',   avatar_url: 'https://www.example.com/avatar.jpg' }, private_key, { algorithm: 'HS256' });

3. Send the user to the portal with the token

Add the token to your portal URL as sso_jwt and redirect the user. They're signed in automatically. For example:

// Build the portal URL with the SSO token const portal_url = 'https://mycompany.ideas.userback.io/p/nMeOGChr32?sso_jwt=' + sso_token;  // Send the user to the Ideas Portal window.location.href = portal_url;

4. Test it

Sign in to your app as a test user, follow the link, and confirm you arrive signed in with the right name and email.

Require SSO

To hide the portal from anyone who isn't signed in through your app:

  1. Set up portal SSO using the steps above.

  2. In Portal Settings > Single Sign-On, turn on Enforce SSO.

  3. Write the message anonymous visitors will see. Put a title on the first line and a description on the second. Add links as [text](url). For example:

Welcome to our private Ideas Portal 🔒 Only signed-in users have access. [Log in or register](https://app.yourapp.com)

Visitors who aren't signed in now see a private screen with your message instead of the portal.

Frequently asked questions

What is a JSON Web Token (JWT)?

A JWT is a standard, signed way to pass information, like a user's email and name, between two systems. See Introduction to JWT.

Is portal SSO the same as workspace SSO?

No. Portal SSO signs in customers who visit your Ideas Portal. Workspace SSO controls how your team logs in to Userback. They're set up separately.

Related articles

Did this answer your question?