nuxt-alt / auth

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

Reading body of undefined #108

Open toniengelhardt opened 5 months ago

toniengelhardt commented 5 months ago

Environment

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: '/login',
      logout: '/login',
      callback: '/login',
      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 commented 5 months ago

use the beta tag

toniengelhardt commented 5 months ago

What do you mean with that?

Denoder commented 5 months ago

use @nuxt-alt/auth@beta

toniengelhardt commented 5 months ago

Oh, thanks! Will try that 🙏🏽