nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.94k stars 925 forks source link

Query parameters lost in redirect with fullPathRedirect enabled #1828

Open izumiya opened 1 year ago

izumiya commented 1 year ago

Version

module: 5.0.0-1637745161.ea53f98 nuxt: 2.15.8

Nuxt configuration

  router: {
    base: '/app/',
    // ...
  },
  auth: {
    fullPathRedirect: true,
    // ...
  }

mode:

Reproduction

What is expected?

The query parameters should not be lost when redirected to a URL after login.

What is actually happening?

Query parameters are being lost.

Steps to reproduce

  1. In nuxt.config.js, set the router.base to a subdirectory, such as /app/.
  2. Enable fullPathRedirect in the auth configuration.
  3. Access a URL with query parameters while not logged in (e.g. https://localhost/app/foo?bar=123).
  4. After completing the login and callback, the URL will open without the query parameters (e.g. https://localhost/app/foo).

Additional information

The problem is caused by normalizePath being executed on the URL retrieved by this.$storage.getUniversal('redirect'). I have created a pull request at https://github.com/nuxt-community/auth-module/pull/1827 to resolve this issue.

Checklist