nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
112 stars 20 forks source link

The subdomain cannot be set for the cookie #123

Closed vutvps4 closed 2 months ago

vutvps4 commented 2 months ago

Environment


Nuxt Config

auth: {
    strategies: {
      auth0: {
        domain: process.env.AUTH0_DOMAIN || 'xxxxxxxx',
        clientId: process.env.AUTH0_CLIENT_ID || 'xxxxxxx,
        audience: process.env.AUTH0_CLIENT_ID || 'xxxxxx',
        scope: ['openid', 'profile', 'email', 'offline_access'],
        responseType: 'code',
        accessType: 'offline',
        grantType: 'authorization_code',
        cookie: {
          name: 'auth._token.auth0',
          options: {
            secure: process.env.NODE_ENV === 'production',
            sameSite: 'lax',
            path: '/',
            domain: '.quickk.local',
          }
        }
      },
    },
    redirect: {
      login: false, 
      logout: '/', /
      callback: '/authentication/callback',
      home: '/',
    },
  },

Reproduction

When setting the domain for the cookie with the option domain: '.quick.local', it doesn't work.

Describe the bug

When I use domain: '.quick.local' to store cookies for subdomains, the cookie is only stored on the main domain quick.local. Subdomains like test.quick.local and admin.quick.localdo not work.

cookie info in main domain

image

cookie info in sub domain

image

Additional context

No response

Logs

No response