Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strapi can't detect $strapi.user on page refresh #201

Closed
adhamfarrag opened this issue Dec 30, 2021 · 2 comments
Closed

Strapi can't detect $strapi.user on page refresh #201

adhamfarrag opened this issue Dec 30, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@adhamfarrag
Copy link

adhamfarrag commented Dec 30, 2021

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.

@adhamfarrag adhamfarrag added the bug Something isn't working label Dec 30, 2021
@adhamfarrag
Copy link
Author

Tried following solutions presented in #138 but didn't help.

@Atinux
Copy link
Contributor

Atinux commented Mar 4, 2023

Can you reproduce it with latest strapi module?

@benjamincanac benjamincanac closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants