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

Authorization header is not being set with Auth Module cookie strategy #607

Open
sadeghi-aa opened this issue Oct 1, 2023 · 0 comments
Open

Comments

@sadeghi-aa
Copy link

sadeghi-aa commented Oct 1, 2023

Hi. I have a NuxtJS project that is running on SSR mode and the auth module configuration is like this:

  auth: {
    redirect: {
      login: '/login,
      logout: '/',
      home: '/',
      callback: false,
    },
    rewriteRedirects: true,
    resetOnError: false,
    fullPathRedirect: true,
    strategies: {
      local: false,
      cookie: {
        token: {
          property: 'data.token',
          required: true,
        },
        options: {
          expires: 7,
          path: '*',
          httpOnly: true,
          secure: true,
        },
        endpoints: {
          login: { url: '/login/', method: 'post' },
          logout: { url: '/logout/', method: 'post' },
          user: false,
        },
        user: {
          property: false,
          autoFetch: true,
        },
      },
    },
    plugins: [
      '~/plugins/auth.js',
      '~/plugins/axios',
    ],
  },

The problem is that Axios doesn't set the Authorization header in the requests after login. I worked around this issue by using the setToken helper in the client side, but this doesn't help with the requests made on the server side. How can I solve this issue?

I didn't have this issue with local strategy. I also tried setting credentials: true in the axios configuration but it didn't help.

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

No branches or pull requests

1 participant