Single Sign-On

SSO (Single Sign-On) allows your users to post feedback using their existing accounts without leaving your site.

To ensure the quality of the feedback you receive, we don't allow anonymous feedback. This also applies to the widget, and to identify your users securely, we use JWT for generating an SSO (single sign-on) token. This token encodes the user's name and email address with your API key so FeedBear knows that it's authentic data from your users, not some random spam.

How it works

  1. In your project settings, tab Widget, copy your private signature key
  2. Store it securely on your server, don't share it
  3. Generate the SSO token using the currently logged in user's name and email like in the snippet below
  4. Pass the resulting token to the Widget

1. Install a JWT library on your server

First, you need to install a JWT library on your server to be able to securely sign your user's data. Based on your platform of choice, there are multiple options:

Node.js https://www.npmjs.com/package/jsonwebtoken
PHP https://github.com/firebase/php-jwt
Ruby https://rubygems.org/gems/jwt
Python https://pypi.org/project/PyJWT
Java https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt/0.7.0
Go https://github.com/dgrijalva/jwt-go

2. Generate SSO token

Depending on your platform, follow the instructions from the respective library documentation. Make sure to include the current user's name and email address. Here's an example from Ruby on Rails application you can reference:

privateKey = 'your-private-key'

def createFeedBearToken(user)
  userData = {
    email: user.email,
    name: user.name
  }

  JWT.encode(userData, PrivateKey, 'HS256')
end

Then, pass the token into the widget on the frontend, like described in Widget setup and configuration article.

Still need help? Contact Us Contact Us