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

BUG, I log in with a user, if I refresh it it takes the last user who logged in #1877

Open
1 of 2 tasks
vitorhugosg opened this issue May 25, 2024 · 1 comment
Open
1 of 2 tasks
Labels

Comments

@vitorhugosg
Copy link

vitorhugosg commented May 25, 2024

Version

module: 5.0.0-1648802546.c9880dc
nuxt: "``^2.15.8

Nuxt configuration

mode:

  • universal
  • spa

Nuxt configuration

auth: {
redirect: {
login: "/auth/login",
},

strategies: {
  local: {
    endpoints: {
      login: {
        url: "v1/auth/login",
        method: "post",
        propertyName: "token",
      },
      logout: {
        url: "v1/auth/logout",
        method: "post",
      },
      user: {
        url: "v1/auth/me",
        method: "get",
        propertyName: "user",
      },
    },
  },
},

},

What is expected?

When I log in to my platform I have a normal login, but when I log out and log in again, I already appear logged in with the last user who logged in, I've already tried doing everything, removing the cloudflare cache, removing all caches possible. I took nuxt hydration, I'm desperate because my app is in production

When I press ctrl+r and it gives getMe, it works normally, but there are times when it doesn't show /me, when it doesn't show /me it crashes with the last login made on the platform

Algúem já teve esse problema?

@vitorhugosg
Copy link
Author

image
image
Putting more evidence here, when I log in with a person, I think the cookie is being saved in the ssr, so when I log in with another person and press CTRL+R I appear logged in with another person, in this case the last person who logged in , I did this test locally, so it only gets the accounts I logged in to, but if I have it on the server, it gets the last person who logged in, I managed to fix it, but it's giving MANY errors, still setting cookies:false, but all Every time I press ctrl+R it logs out.

And some pages give a bug, because it can't read localStorage on the client side.

Does anyone know if this has happened to you using nuxt2 auth? Would it be one of remodeling my entire login system? I have a similar login on other platforms, I never had this problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant