What I want to create
I want to secure a web-page. I don't want someone to view it until they have logged in.
Say, I want to secure route
localhost:1337/shop
I know strapi provide authentication option for API and I am able to secure the route.
So until a GET request for localhost:1337/shop has a Autherization: Bearer 'Token' in its header, it will show a 403 error (which is definitely correct).
Problem
If I am making a GET request directly to localhost:1337/shop (directly means by just typing it in my browser's address bar), I cannot set the header and so is the 403 forbidden error appear there.
Solutions I have tried
I make the localhost:1337/shop to public api (remove find from authentication).
I have stored the jwtToken into cookies and I can fetch it on server ,but when I use below code on the server it throws an error saying.
Error: The model user can't be found
strapi.query('user').find({ id: 1 }).then((result)=>{
console.log(result)
}
I have not used the cookies in the above code but the problem is same.
I know I am definitely somewhere wrong in understanding the concepts of strapi.
Is there a better way to approach Cookies and authentication is Strapi.