[SOLVED] Missing jwtSecret. Please, set configuration variable “jwtSecret” for the users-permissions plugin in config/plugins.js

Issue

This Content is from Stack Overflow. Question asked by George Garman

Strapi Error

I am trying to deploy a Strapi app to Heroku. I have set APP_KEYS and JWT_SECRET config vars in Heroku. I have also added this code to plugins.js as stated in this question. But I am still getting this error (see image). Can anyone help with this?

const crypto = require("crypto");

module.exports = ({ env }) => ({
  "users-permissions": {
    config: {
      jwtSecret: env("JWT_SECRET") || crypto.randomBytes(16).toString("base64"),
    },
  },
});



Solution

Just try adding a new file in ‘/config’ named plugins.js with this code:

const crypto = require('crypto');

module.exports = ({ env }) => ({
  'users-permissions': {
    config: {
      jwtSecret: env('JWT_SECRET') || crypto.randomBytes(16).toString('base64'),
    },
  },
});


This Question was asked in StackOverflow by John Smith and Answered by MCSI It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?