Migration to v7 issue

After migration from v6 we are getting this issue:

[forest] 🌳🌳🌳  Unable to register the client
{
  "configuration": {
    "authorization_endpoint": "https://api.forestadmin.com/oidc/auth",
    "device_authorization_endpoint": "https://api.forestadmin.com/oidc/device/auth",
    "claims_parameter_supported": false,
    "claims_supported": [
      "sub",
      "email",
      "sid",
      "auth_time",
      "iss"
    ],
    "code_challenge_methods_supported": [
      "S256"
    ],
    "end_session_endpoint": "https://api.forestadmin.com/oidc/session/end",
    "grant_types_supported": [
      "authorization_code",
      "urn:ietf:params:oauth:grant-type:device_code"
    ],
    "id_token_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "issuer": "https://api.forestadmin.com",
    "jwks_uri": "https://api.forestadmin.com/oidc/jwks",
    "registration_endpoint": "https://api.forestadmin.com/oidc/reg",
    "response_modes_supported": [
      "query"
    ],
    "response_types_supported": [
      "code",
      "none"
    ],
    "scopes_supported": [
      "openid",
      "email",
      "profile"
    ],
    "subject_types_supported": [
      "public"
    ],
    "token_endpoint_auth_methods_supported": [
      "none"
    ],
    "token_endpoint_auth_signing_alg_values_supported": [],
    "token_endpoint": "https://api.forestadmin.com/oidc/token",
    "request_object_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "request_parameter_supported": false,
    "request_uri_parameter_supported": true,
    "require_request_uri_registration": true,
    "claim_types_supported": [
      "normal"
    ]
  },
  "registration": {
    "redirect_uris": [
      "http://localhost:3310/forest/authentication/callback"
    ],
    "token_endpoint_auth_method": "none"
  },
  "error": {
    "error": "unauthorized_client",
    "error_description": "Web clients must be authenticated"
  }
}

“forest-express-mongoose”: “^7.0.0”,
“express”: “^4.17.0”,

  • Database Dialect: Mongo
  • Database Version: 4.0.13
  • Project Name: workpuls

Hello @ipetrovic,

How did you configure you environment secret? Are you using an environment variable? Can you check that its value is correctly set and matches the configuration of the environment?

We have our own configuration files where we pull envSecret and authSecret from

const chalk = require('chalk');
const path = require('path');
const Liana = require('forest-express-mongoose');

const { objectMapping, connections } = require('../models');

const config = require('../lib/config');

module.exports = async function (app) {
  app.use(await Liana.init({
    configDir: path.join(__dirname, '../forest'),
    envSecret: config.forestadmin.env_secret,
    authSecret: config.forestadmin.auth_secret,
    objectMapping,
    connections,
  }));

  console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));
};

This was working properly in v6

Ok, I guess that this is the reason why it does not work properly.

We will fix this configuration issue, because the authentication part is reading the value FOREST_ENV_SECRET from environment variables and is not using the one provided in the init function.

Can you initialize process.env.FOREST_ENV_SECRET before calling require('forest-express-mongoose') and see if it fixes the issue?

Ok, that works, but we have to do it in app.js since that is the first place where it is required.

How soon can we expect the fix?

We will work on it this week, I’ll keep you posted when we will release it.

Hello @ipetrovic,

We just released new versions of forest-express-sequelize and forest-express-mongoose that fix this issue.

Can you test with forest-express-mongoose@7.8.3?

Working fine on 7.9.2, I didn’t chat 7.8.3

1 Like