Open view - Forest cannot authenticate the user for this request

Feature(s) impacted

I’ve implemented a webservice which open an image (stored on minio bucket) on a new tab on click on a link displayed on a summary view.

Observed behavior

I have the following error displayed when the tab is open (after click on the link).

{"errors":[{"status":401,"detail":"Forest cannot authenticate the user for this request.","name":"Unauthorized"}]}

Expected behavior

The document should be displayed (it’s working on an other environment), i’m using the same code.

Failure Logs

No logs displayed in google chrome console.

Context

  • Project name: Nostrum Care
  • Team name: *
  • Environment name: *
  • Agent type & version:
    “express-jwt”: “6.1.2”,
    “forest-express-sequelize”: “^8.0.0”,
    “fs”: “^0.0.1-security”,
    “http-status-codes”: “^2.2.0”,
    “minio”: “^7.0.28”,
  • Recent changes made on your end if any: …

Hey @nadiab :wave:

Would you mind sharing the code and the request (payload and response) that generates the error message?
Any other relevant informations to share in order to help us either reproduce or better understand the issue?

Thanks in advance

Hello,

Thanks to you, we were able to solve the problem.
The problem is that our route is blocked by the middleware forest during the generation of the new page, so we put a new url via the startsWith as the image above.

Thanks for everything :pray:!

After investigation, the issue was related to the authentication middleware running on the route associated with the file.

2 solutions here:

  • Add the route before the authentication middleware is attached (In app.js for forest-cli generated project)
  • Add the route after the authentication middleware, but also add the route path as allowed in the PUBLIC_ROUTES array.
1 Like