Client Library
UI Functions

Rate this page:


Asynchronously request a signed JWT from Trello for the current member.

  'board-buttons': async function (t, opts) {
    if (t.isMemberSignedIn()) {
      const jwt = await t.jwt({
        state: JSON.stringify({ hello: 'world' }),
    return [];

If you checked the console you would find a JWT like:


We can use to better understand what this JWT contains.

We see the payload is:

  // the id of your Power-Up
  idPlugin: "5e66784c606cb1160a8f5dc0",
  // the id of the board the user is currently using your Power-Up on
  idBoard: "5e667811606cb1160a8f5bf7",
  // the id of the member currently using your Power-Up
  idMember: "5e645dc2c4205e1416218404",
  // optional Power-Up defined state, max of 2048 characters
  state: "test",
  // issued at time, in seconds
  iat: 1583858668,
  // expiration time, in seconds
  exp: 1583859568,
  // issuer
  iss: "trello"

Using and validating Trello JWTs

The purpose of these JWTs is for you to be able to secure the communication between your Power-Up and your server. If you need to know that a request made by your Power-Up was made on behalf of a particular Trello user, you have two main ways of accomplishing that.

  1. If you already need and are retrieving Trello OAuth tokens for members who use your Power-Up, you can send the token in requests to your server, and validate the token by making a request with it to Trello.
  2. If you don't need a Trello OAuth token (you don't need to talk to Trello's REST API), then you should use this t.jwt() method and send the resulting JWT with requests to your server.

Here we will go into more details on what you would do on your server to decode and validate the JWT.

To start we recommend checking out the recommended libraries for your programming language / environment on

For this example we will assume a NodeJS environment and use jsonwebtoken.

const bent = require('bent');
const jwt = require('jsonwebtoken');

const getJSON = bent('json', { 'user-agent': 'bent/7.1.1' });

let publicKeys;
let publicKeysExpiry;
const getPublicKeys = async () => {
  // get a fresh set if needed
  if (!publicKeys || publicKeysExpiry < {
    const resp = await getJSON('');
    publicKeys = resp.keys;
    // cache for 4 hours
    publicKeysExpiry = + 14400000;

  return publicKeys;

const decodeAndValidate = async (token) => {
  const publicKeys = await getPublicKeys();

  // the vast majority of the time, Trello will provide a single public key
  // but should Trello need to rotate our keys we may for brief periods serve
  // two public keys
  const errors = [];
  let decoded;
  for (let key of publicKeys) {
    try {
      decoded = jwt.verify(token, key);
    } catch (err) {

  if (decoded) {
    // the JWT is valid, generally we should now confirm that it belongs to us
    if (decoded.idPlugin !== "YOUR-POWER-UP-ID") {
      // this JWT is from a different Power-Up, not ours
      throw new Error("Unexpected plugin");
    return decoded;

  // there are a variety of reasons it might not be valid
  // the JWT could be expired, or the signature could be invalid for example
  throw errors[0];

Ok, so how do we know Trello's public key? Trello publishes a list of our in use public keys at:

  "keys": [
    "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvBoGlGS7BZSHL5G2HWIu\nlWC+5QlUGe25630GfuKiLBzOF5N2BnBq5fMwM1W86Ur4zgfJt88UidWxyAw14JD3\nnPLjtRQZVJQNtoesVhhzXuDe+/jNWXNLJfgwRV7+Jl/p2B+vIMOjdN5QZp+mjNM8\nx/TJjHIldtIDHJJUZ1NbI0GLQ4a9VtZz+B0WquQkeSUVmuiA/nFZP6w0mGWRz+qr\nuO9pZnQwU6pHOLzbZpGOAbnsMelE1C4D7ofHH6i/sXvPHmgNwe7ndkC+6FcPrbB8\n+imYJVoR3am5AwIAjDLHz1BM4IVmJrNJknh/RaFZNAZ4573oZPrq/szlG7BGugKo\nz0DjbbrW5NjO+9/B+4mXtt4k7uc8C4WoaPYFX0SZVLgEOyxnsvHO+Cp/4U8XiZel\nW1He30argtYFx/LtMnj6+PiFbsx5hOsiiHpdobFHImy/5dLReIC7HAhYI+NjXCru\nKINBV5F9fbA2YAUVWdFnDs4xdh6eGQCXsZkczS8/EZ5HnQzwc9Lpr0pZTkxB1089\nwls56RLb/GVWloRAwXmMCdRDKj2g9HbQWcCLjVavwCUg8zGgl0R0LxLfpPd0qUxj\nQ/m9a5+R5P6+YMVlY8ve5Ou6B4IU7k+g5/Qbyf6dpJtZhE2R8LMtKNai5SGlCMy9\n1gfQ+Ynk+Ve6h5RiJOIbrf0CAwEAAQ==\n-----END PUBLIC KEY-----"

This is a list so that if Trello needs to rotate our private key, we can do so without breaking your Power-Ups, as we will publish the new public key in advance of beginning to sign with its private key counterpart.

We recommend that you poll this route perhaps daily, but at most hourly, and also have logic in your application to request the latest public keys in the event of a signature verification error.

Rate this page: