You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I tried about "your query " and locally fixed this with the following
node_modules\json-server-auth\dist\guards.js
added the following line ( need to add userId in queryString )
if (hasRightUserId) {
req.query.userId = req.claims.sub; /* need to add userId in queryString */
next();
} else {
res.status(403).jsonp('Private resource access: entity must have a reference to the owner id');
}
given: "users": [ {"id": 1}, {"id": 2} ], "posts": [ {"id": 1, "text": "hello", "userId": 1}, {"id": 2, "text": "world", "userId": 2}] and
access token: xxx.xxx.xxx for user id:1
when: curl -H "Authorization: Bearer xxx.xxx.xxx" http://localhost:3000/600/posts
expect: only [ { "id": 1, "text": "hello", "userId": 1} ]
actual: [ { "id": 1, "text": "hello", "userId": 1}, {"id": 2, "text": "world", "userId": 2} ]
The text was updated successfully, but these errors were encountered: