Forest cannot authenticate the user for this request in prod and localhost

Feature(s) impacted

I can’t access any of the generated routes (e.g forest/authentication, forest/user) - in nodejs project

Observed behavior

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

Expected behavior

I expect to receive a JSON response

Context

  • Project name: EdityourFilm
  • Team name: Operations
  • Environment name: localhost / production
  • Agent (forest package) name & version: I’m using agent version 8.5.15
  • Database type: postgres
  • Recent changes made on your end if any: no, I just generated the project using forest-cli command, I didn’t edit anything yet

Hi @Mehdi_Marouani and welcome to our community !

I am not sure to see what you were expecting by a 'JSON response".
Could you please reformulate what you were trying to do?

Best regards,

Shohan

Hi Shohan,

I’m still new to forest admin, and I just set up a project that connects to a Postgres database that has one table (“user” table).
I see that some folders are generated (/middleware, /routes, etc), and the routes are generated with CRUD functions (List, delete, update, etc.), so I tried to access the list of “users” (from the database) in my localhost “http://localhost:3310/forest/user” and I got the error message mentioned above.

The idea of using admin forest is to give the ability to some users to manage data (on https://app.forestadmin.com/) and also expose some API to be consumed by our website (e.g list of users)

To use this endpoint you will have to use an authentification token.
Here is a thread explaining how you could do it.

Best regards,

Shohan

I just want to add that, even though it is technically possible, exposing the API to be consumed by external applications is not a feature supported or promoted. Support on this part will not be proposed by our side.

Best regards,

Shohan