Note
The widget is an advanced feature. For most cases, we recommend using your full Canny site instead (your-company.canny.io).
Still unsure which to use? Contact us
Single Sign-On
These are instructions on how to generate Single Sign-On tokens on your server. These token can be used to authenticate your users in our web/mobile widget.
  1. Here's how it works:
    • To find your private key, log in above.
      Store your private key on your server and don't share it.
    • When a user wants to use the widget, send a request to your server to generate an SSO token.
    • On your server, generate a token using the snippet below.
    • Pass the token back to your app and into our widget.
    • We'll use that token to authenticate your user.
    For security reasons, Single Sign-On tokens can't authenticate users who are admin users for other companies. These users will have to log in using https://canny.io/login
  2. 1. Install a JWT library
    We use JSON Web Tokens to securely authenticate your users. First, install the appropriate JWT library for your server.
    Node.js
    C#
    Go
    Java
    PHP
    Python
    Ruby
    npm install --save jsonwebtoken
  3. 2. Generate tokens on your server
    Node.js
    C#
    Go
    Java
    PHP
    Python
    Ruby
    var jwt = require('jsonwebtoken');
    
    var PrivateKey = 'YOUR_PRIVATE_SSO_KEY';
    
    function createCannyToken(user) {
      var userData = {
        avatarURL: user.avatarURL, // optional, but preferred
        email: user.email,
        id: user.id,
        name: user.name,
      };
      return jwt.sign(userData, PrivateKey, {algorithm: 'HS256'});
    }
    Any field you can specify via identify / our API also works via SSO tokens. Consult this page for a full list of fields.
  4. 3. Validate your SSO Token
    Paste a sample SSO token in the following input to verify it will work correctly.
  5. Questions
    If you have any questions or issues, email us at support@canny.io and we'll get back to you ASAP.