Strapi 403 error problem

Hello everyone please i am working on strapi and i’m trying to connect my react to it
i keep getting error 403 while trying to make a get request,
this is the connection code

   useEffect(() => {
    const fetchData = async () => {
      try {
        const data = await axios.get(
          process.env.REACT_APP_API_URL + "/womens",
          {
            headers:{
              Authorization:"Bearer" +  process.env.REACT_APP_API_TOKEN,
            },
          }
        );
        console.log(data);
      }catch (err) {
        console.log(err);
      }
    };
    fetchData();
   })

My token is correct cause that was the only thing i thought could have gone wrong…please help me out this is the result i am getting from strapi
[2023-09-22 09:47:17.969] http: GET /api/womens (44 ms) 403
[2023-09-22 09:47:18.009] http: GET /api/womens (20 ms) 403
[2023-09-22 09:47:35.768] http: GET /api/womens (6 ms) 403
[2023-09-22 09:47:35.863] http: GET /api/womens (83 ms) 403
:pray:

Hello, did you check under setting → roles if your front end has the permission to access the data?

You need to tick “find” and/ or “find one” (either authenticated or public user, depending who is allowed to see the data) to make “womens” at least read-only.

Not allowing access is the main reason for the Strapi 403 error.

1 Like

Thank you so much @DanielHuebschmann i was able to fit it with your help

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.