nuxt-auth icon indicating copy to clipboard operation
nuxt-auth copied to clipboard

ProviderLocalRefresh doesn't store the cookie for the auth token

Open mlorenzog opened this issue 1 year ago • 3 comments

Environment

Reproduction

Start a new project, using this auth configuration:

auth: { globalAppMiddleware: { isEnabled: true }, // Important, this variable is set at build time baseURL: process.env.AUTH_BASE_URL // https://sidebase.io/nuxt-auth/configuration/nuxt-config provider: { type: 'refresh', pages: { login: '/auth/login' }, endpoints: { signIn: { path: '/api/login', method: 'post' }, getSession: { path: '/api/v1/user/data', method: 'get' } // signOut: { path: '/logout', method: 'post' }, // signUp: { path: '/register', method: 'post' }, },

  refreshToken: {
    signInResponseRefreshTokenPointer: '/refresh_token'
  },
  token: {
    signInResponseTokenPointer: '/token'
  }
}

}

Describe the bug

Using that configuration only the refresh token is stored at the cookie, not the session token.

We have tested it and detected that changing the same-site attribute of the token cookie to "lax" it works, but by default the same-site attribute is setted as "none" for that schema. According to the source code the default value should be "lax" (https://github.com/sidebase/nuxt-auth/blob/cb3db19563f8cb3af6dd63097e91305697c3ce8a/src/runtime/types.ts#L168)

Additional context

No response

Logs

No response

mlorenzog avatar Jul 04 '24 10:07 mlorenzog

Related??? https://github.com/sidebase/nuxt-auth/issues/790

agracia-foticos avatar Jul 05 '24 06:07 agracia-foticos

@agracia-foticos I don't think it is related, as #790 refers to authjs provider, while this refers to refresh provider

phoenix-ru avatar Jul 11 '24 13:07 phoenix-ru

Hello I had a similar issue and I solved it by clearing the browser data. But before doing that, try checking if the problem is solved in an incognito browser window.

andre-silva9975 avatar Jul 15 '24 13:07 andre-silva9975