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

Nuxt 3 Cookie Disappears on page reload #382

Open
rrubio opened this issue Jan 4, 2024 · 2 comments
Open

Nuxt 3 Cookie Disappears on page reload #382

rrubio opened this issue Jan 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rrubio
Copy link

rrubio commented Jan 4, 2024

On user login, the cookie gets set. However, on page refresh the cookie is deleted. Also, the expiry doesn't appear be to taking place. This is my nuxt.config. Any ideas.

On the following post they suggested upgrading strapi and nuxt, which i've tried, with the same outcome - #354

Version

@nuxtjs/strapi: 4.13.6
nuxt: 3.7.4

  runtimeConfig: {
    strapi: {
      url: 'https://login.7da2-202-129-81-163.ngrok-free.app',
      prefix: '/api',
      version: 'v4',
      cookie: {
        path: '/',
        maxAge: 60 * 60 * 24 * 30, // 30days login time
      },
      cookieName: 'strapi_jwt',
    },

I have also tried setting manually after login, but no luck -

        const { login } = useStrapiAuth()

        try {
            const response = await login({ identifier: identifier, password: password })
            await useCookie('strapi_jwt', { 
              maxAge: 60 * 60 * 24 * 7,
              path: '/'
            })            

            return response
        } catch (e) {            
            throw e
        }

@rrubio rrubio added the bug Something isn't working label Jan 4, 2024
@rrubio rrubio changed the title Cookie Disappears on page reload Nuxt 3 Cookie Disappears on page reload Jan 4, 2024
@FlambeSk
Copy link

FlambeSk commented Jan 9, 2024

I have updated to version 1.10.1 and it's working already
"@nuxtjs/strapi": "^1.10.1",

@rrubio
Copy link
Author

rrubio commented Jan 11, 2024

Thank you. I'll test it in the next few days and confirm.

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

2 participants