strapi
strapi copied to clipboard
Strapi can't detect $strapi.user on page refresh
Actually problem starting happening months ago and I didn't realize it. Focused on short fixes by moving $strapi.user to another store object and use it from there. Application works well beside page refreshing, in development mode I lose $strapi.user, in production it logs user out.
Tried modifying middleware to rely on strapi cookie instead of $strapi.user and it stopped logging me out.
export default function ({ app, redirect }) {
if (!app.$storage.getCookie('userJwt')) {
redirect('/login')
}
}
But now I have strange behavior, which's is on page refresh, it doesn't log me out as cookie is still there, but some reason storage gets wiped in production, dev mode it works perfectly.
Tried following solutions presented in #138 but didn't help.
Can you reproduce it with latest strapi module?