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

After reloading the page the access token is deleted #1002

Open
kirilldonenko opened this issue Feb 24, 2025 · 2 comments
Open

After reloading the page the access token is deleted #1002

kirilldonenko opened this issue Feb 24, 2025 · 2 comments
Labels
bug A bug that needs to be resolved needs-reproduction Action needed: A valid reproduction of the issue needs to be added

Comments

@kirilldonenko
Copy link

kirilldonenko commented Feb 24, 2025

Environment

  • Operating System: Linux
  • Node Version: v22.3.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.10.4
  • Package Manager: yarn@1.22.22
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

"@sidebase/nuxt-auth": "^0.10.0"
I see this problem only in the QA environment. Locally everything works correctly.

  `// in nuxt.config
  auth: {
      isEnabled: true,
      baseURL: `${process.env.NUXT_PUBLIC_PROTOCOL}${process.env.NUXT_PUBLIC_DOMAIN}:${process.env.NUXT_PUBLIC_PORT}/`,
      provider: {
        type: 'local',
        endpoints: {
          signIn: {path: 'api/auth/login', method: 'post'},
          signOut: {path: 'api/auth/logout', method: 'post'},
          signUp: {path: 'api/auth/register', method: 'post'},
          getSession: {path: 'api/user', method: 'get'},
        },
        token: {
          signInResponseTokenPointer: '/access_token',
          type: 'Bearer',
          cookieName: 'auth._token',
          headerName: 'Authorization',
          maxAgeInSeconds: 60 * 60 * 3,
          sameSiteAttribute: 'lax',
          cookieDomain: `${process.env.NUXT_FRONTEND_DOMAIN}`,
          secureCookieAttribute: false,
          httpOnlyCookieAttribute: false,
        },
        refresh: {
          isEnabled: true,
          endpoint: {path: 'api/auth/refresh', method: 'post'},
          refreshOnlyToken: false,
          token: {
            signInResponseRefreshTokenPointer: '/refresh_token',
            refreshRequestTokenPointer: '/refresh_token',
            cookieName: 'auth._refresh-token',
            maxAgeInSeconds: 60 * 60 * 3,
            sameSiteAttribute: 'lax',
            secureCookieAttribute: false,
            cookieDomain: `${process.env.NUXT_FRONTEND_DOMAIN}`,
            httpOnlyCookieAttribute: false,
          }
        },
      },
      sessionRefresh: {
        enablePeriodically:  1000 * 60 * 60,  
        enableOnWindowFocus: false,          
      }
    },

`
Access and refresh tokens(auth._token and auth._refresh-token) is automatically saved in a cookie on the local domain - "localhost", and on the QA environment on the domain - ".my-qa-domain"

Describe the bug

If I reload the page after authentication, the access token will be deleted, although the refresh token will not be deleted. I only observe this behavior in the QA environment. Maybe someone has encountered something similar?

Additional context

No response

Logs

@kirilldonenko kirilldonenko added bug A bug that needs to be resolved pending An issue waiting for triage labels Feb 24, 2025
@phoenix-ru phoenix-ru added needs-reproduction Action needed: A valid reproduction of the issue needs to be added and removed pending An issue waiting for triage labels Feb 27, 2025
Copy link

Hello 👋

Please provide a reproduction for this issue 🙏

How can I create a reproduction?

Please use one of the following links to reproduce your issue.

Please ensure that the reproduction is as minimal as possible. This will allow us to isolate the issue as best as possible.

Here are some more amazing posts about the importance of reproductions:

@phoenix-ru
Copy link
Collaborator

Hi, it would be great if you (or someone you also experiences it) could provide a reproduction repo/stackblitz. When you say "only in QA", this makes our task of reproducing and fixing close to impossible 🙁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved needs-reproduction Action needed: A valid reproduction of the issue needs to be added
Projects
None yet
Development

No branches or pull requests

2 participants