Request failed with status code 403 in test environment

Hello,

Finally, I figured out the problem. It’s not related to the versions. The problem still occurred on v8.2.8.
By digging in the forest-express-sequelize code, we found the property role was mandatory in the JWT sent to the forest endpoints. So If I update the code shown before, the code looks like that:

export const getForestToken = async () => {
  const FOREST_AUTH_SECRET = env().FOREST_AUTH_SECRET;
  const user = {
    id: "44907",
    email: "toto.toto@swan.io",
    firstName: "toto",
    lastName: "toto",
    team: 62937,
    renderingId: 105033,
    role: 957,
  };
  return jwt.sign(user, FOREST_AUTH_SECRET, {
    expiresIn: "30 minutes",
  });
};

I don’t know why it appears now but it solved our problem.
You should update your doc : Run automated tests - Woodshop
It doesn’t mention this property.

1 Like