Skip to content

post urlencoded to login #112

Description

@amery

hi, I need to POST url encoded username/password to login for for some reason auth is intercepting the login and failing

the config looks like:

export default defineNuxtConfig({
  // ...
  auth: {
    // middleware
    globalMiddleware: true,

    strategies: {
      local: {
        scheme: 'refresh',

        token: {
          property: 'access_token',
        },

        endpoints: {
          login: {
            url: `${apiPrefix}/auth/token`,
            method: 'post',
          },
          logout: {
            url: `${apiPrefix}/auth/me`,
            method: 'delete',
          },
          refresh: {
            url: `${apiPrefix}/auth/refresh`,
            method: 'post',
          },
          user: {
            url: `${apiPrefix}/auth/me`,
            method: 'get',
          },
        },

        user: {
          property: '',
          autoFetch: true,
        },
      },
    },
  },

but in $auth login and refresh are replaced with /_auth/local/local/authorize which dies with Invalid JSON body if I url encode the body.

    const res = await $auth.loginWith('local', {
      body: encodeURIComponent(state),
      Headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
      },
    });

any suggestion about what I'm missing?


  • Operating System: Linux
  • Node Version: v18.19.1
  • Nuxt Version: 3.10.3
  • CLI Version: 3.10.1
  • Nitro Version: 2.9.1
  • Package Manager: pnpm@8.15.4
  • Builder: -
  • User Config: srcDir, telemetry, devtools, extends, modules, eslint, fontMetrics, googleFonts, typescript, runtimeConfig, auth, routeRules, vite
  • Runtime Modules: @nuxtjs/eslint-module@4.1.0, @nuxtjs/fontaine@0.4.1, @nuxtjs/google-fonts@3.1.3, @nuxt/ui@2.14.2, nuxt-svgo@4.0.0, @nuxt-alt/auth@3.1.6, @pinia/nuxt@0.5.1
  • Build Modules: -

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions