Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reading body of undefined #108

Open
toniengelhardt opened this issue Jan 30, 2024 · 4 comments
Open

Reading body of undefined #108

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

Comments

@toniengelhardt
Copy link
Contributor

toniengelhardt commented Jan 30, 2024

Environment

  • Operating System: Darwin
  • Node Version: v21.5.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: pnpm@8.14.3
  • Builder: -
  • User Config: ssr, runtimeConfig, modules, imports, experimental, app, pwa, sourcemap, devtools, router, css, postcss, vite, nitro, typescript, http, auth, colorMode, plausible
  • Runtime Modules: @nuxt/devtools@1.0.8, @kevinmarrec/nuxt-pwa@0.17.0, normalizedModule(), @nuxt-alt/auth@3.1.6, @nuxt-alt/http@1.7.10, @nuxtjs/color-mode@3.3.2, @nuxtjs/plausible@0.2.4, @vueuse/nuxt@10.7.2, nuxt-icon@0.6.8, v-wave/nuxt
  • Build Modules: -

Nuxt Config

auth: {
    globalMiddleware: true,
    redirectStrategy: 'query', // Important! Otherwise, there will be an infinite logout loop.
    stores: {
      cookie: {
        options: {
          secure: import.meta.env.NODE_ENV === 'production', // Enable in production only.
          sameSite: 'lax', // IMPORTANT!
        },
      },
    },
    redirect: {
      login: '/#',
      logout: '/#',
      callback: '/#',
      home: '/write',
    },
    strategies: {
      local: {
        scheme: 'refresh',
        token: {
          property: 'access',
          type: 'JWT',
        },
        refreshToken: {
          property: 'refresh',
          data: 'refresh', // This is not a JWT token!
        },
        user: {
          property: false,
        },
        endpoints: {
          login: {
            url: `${import.meta.env.API_URL}/auth/token/`,
            method: 'post',
          },
          refresh: {
            url: `${import.meta.env.API_URL}/auth/token/refresh/`,
            method: 'post',
          },
          user: false,
          logout: {
            url: `${import.meta.env.API_URL}/user/logout/`,
            method: 'post',
          },
        },
      },
      facebook: {
        clientId: import.meta.env.FACEBOOK_CLIENT_ID,
        responseType: 'code',
        endpoints: {
          token: `${import.meta.env.BACKEND_URL}/auth/social/facebook/`,
          userInfo: `${import.meta.env.API_URL}/user/`,
        },
        token: {
          // By default the token type is Bearer, but simple_jwt is configured
          // to accept only JWT tokens.
          type: 'JWT',
        },
      },
      google: {
        clientId: import.meta.env.GOOGLE_CLIENT_ID,
        scope: [
          'profile',
          'email',
        ],
        responseType: 'code',
        codeChallengeMethod: '', // This is important!
        endpoints: {
          token: `${import.meta.env.BACKEND_URL}/auth/social/google/`,
          userInfo: `${import.meta.env.API_URL}/user/`,
        },
        token: {
          // The token type needs to match the AUTH_HEADER_TYPES setting under
          // SIMPLE_JWT in the Django settings (Bearer by default).
          type: 'JWT',
          property: 'access',
        },
        refreshToken: {
          // The refresh token is not a JWT token!
          property: 'refresh',
        },
      },
    },
  },

Reproduction

Can't reproduce.

Describe the bug

I'm getting a lot of these errors, should there be a check if endpoint is undefined?

Screenshot 2024-01-30 at 00 37 45

Additional context

No response

Logs

No response

@Denoder
Copy link
Member

Denoder commented Jan 30, 2024

use the beta tag

@toniengelhardt
Copy link
Contributor Author

What do you mean with that?

@Denoder
Copy link
Member

Denoder commented Jan 31, 2024

use @nuxt-alt/auth@beta

@Denoder Denoder added bug Something isn't working and removed pending triage labels Jan 31, 2024
@toniengelhardt
Copy link
Contributor Author

Oh, thanks! Will try that 🙏🏽

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants