strapi icon indicating copy to clipboard operation
strapi copied to clipboard

Server responds with 401 after some time of inactivity, works after reload

Open lnvglr opened this issue 3 years ago • 0 comments

After some time of inactivity, api calls return a 401, when reloading (once or twice) it works.

I call the api using useStrapi4() and find(). The Public role has permission to find and findOne of the collection type I am querying.

The request:

...
mounted() {
  this.$strapi.find("home").then(({data}) => {
    this.page = data;
  });
},
...

The response:

{
  "data": null,
  "error": {
    "status": 401,
    "name": "UnauthorizedError",
    "message": "Missing or invalid credentials",
    "details": {}
  }
}

I have a hunch that it may have something to do the the JWT token, but I don't know how to debug it.

Strapi 4.1.9 Nuxt 3.0.0-rc.5 DB Postgres Hosted on Railway.app

lnvglr avatar Aug 28 '22 13:08 lnvglr