Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strapi API calling error: {"statusCode":403,"error":"Forbidden","message":"Forbidden"}

Tags:

strapi

I am working with strapi and i am getting an error 403 Forbidden on calling an api e.g http://localhost:1337/data

I've called all the APIs and the result is same 403 error I've tried it with postman also.

In the api route.js file i have this:

 {       "method": "GET",       "path": "/data",       "handler": "data.find",       "config": {         "policies": []       } 

Strapi server is localhost port:1337

A GET call from browser http://localhost:1337/data

I have a collection of data in mongodb it should give the json document but it is giving this Error:{"statusCode":403,"error":"Forbidden","message":"Forbidden"}

like image 742
user3699398 Avatar asked Dec 28 '18 09:12

user3699398


1 Answers

Go to http://localhost:1337/admin/settings/users-permissions/roles then to Public role and in the Application permission section check findone and find, it will cover needs of an API for frontend app.

Remember to not select more than you need, it will become publicly available for everyone, it may be like chmod 777, but worse.

like image 128
igloczek Avatar answered Sep 22 '22 02:09

igloczek