Single Sign-On

Single Sign-On

If your customers already have user accounts in your application, then you can enable Single Sign-On (SSO) to automatically log in your customers to LoopedIn as well.

In order to implement SSO, we use JSON Web Tokens (JWT) to securely exchange user information. You will need to generate a JWT on your server, passing in the user credentials required in order to identify your customers.

User Flow

When SSO has been enabled, the following user flow is observed:

1. Unauthenticated users will be prompted to log in when they attempt to vote, comment or submit content
2. Upon clicking "Log in", they will be redirected to your website, where they can sign up or login
3. Your website will generate an SSO JWT, and return this to LoopedIn (note: when directing the user to your log in page, we provide a `returnURL` parameter, which should be used when returning the user back to LoopedIn)
4. LoopedIn will process the provided JWT, and identify the user
5. The user will now be authenticated and can vote, comment or submit content

SSO Setup

1. Get your SSO Key from  https://app.loopedin.io//settings#/sso


2. Create a page on your application to generate the SSO JWT (must be a JWT create using the HS256 algorithm)
3. Use your SSO Key to generate a valid SSO JWT
4. Enter the URL of the webpage from step 2 into the "Login URL" field on  https://app.loopedin.io//settings#/sso

5. Click "Test URL" - this will make a call to the URL provided, and check for a valid response
6. If a valid response is received, then the "Enable SSO" toggle will become available for you to switch on


NodeJs Example

1. Install a JWT library, such as `jsonwebtoken`
npm install jsonwebtoken

2. Create SSO token and redirect to LoopedIn
  1. const jwt = require('jsonwebtoken');
  2. const ssoToken = 'YOUR_SSO_KEY';
  3. const userData = {
  4.    email: user.email,
  5.    name: user.name
  6. }
  7. const userToken = jwt.sign(userData, ssoToken, {algorithm: 'HS256'});
  8. const ssoRedirect = req.query.returnURL;
  9. return res.redirect(`${ssoRedirect}?token=${userToken}`);
Note: when directing the user to your log in page, we provide a `returnURL` parameter, which should be used when returning the user back to LoopedIn, as seen above.


    • Related Articles

    • API Quick Start Guide

      Overview You can use our API to access Productstash API endpoints, which can be used to view, create and update Ideas, Roadmap Cards, Updates and more. We support CORS (cross-origin resource sharing) for public endpoints allowing you to call the API ...