Skip to content

Update documentation on endpoint paths starting with / #782

Closed
@spras

Description

@spras

Environment

  • Operating System: Darwin
  • Node Version: v20.10.0
  • Nuxt Version: 3.12.2
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.6
  • Package Manager: yarn@1.22.22
  • Builder: -
  • User Config: debug, ssr, devtools, runtimeConfig, modules, css, vuetify, auth, features, app, components, hooks, build
  • Runtime Modules: vuetify-nuxt-module@0.14.1, @nuxt/test-utils/module@3.13.1, @nuxtjs/device@3.1.1, @sidebase/nuxt-auth@0.8.0-rc.1, @vueuse/nuxt@10.11.0
  • Build Modules: -

Reproduction

here is my nuxt.config.ts

  auth: {
    baseURL: process.env.CUSTOM_API_URL + "/",
    globalAppMiddleware: {
      isEnabled: true,
    },
    session: {
      enableRefreshPeriodically: false,
      enableRefreshOnWindowFocus: true,
    },
    provider: {
      type: "local",
      token: {
        maxAgeInSeconds: 18000,
        sameSiteAttribute: "strict",
        secureCookieAttribute: true,
      },
      endpoints: {
        getSession: { path: "/api/session", method: "get" },
      },
      pages: {
        login: "/connexion",
      },
    },
  },

Describe the bug

I'm currently testing upgrade from 0.7.2 to 0.8.0-rc

This break my config : local provider and auth.baseURL defined to a custom base url ex : https://example.com/

Login is posted to the nuxt base URL , not to my custom base url

As a workaround I had to redefine all the endpoints and removing the / prefix .

endpoints: { 
       signIn: { path: 'login', method: 'post' },        
       signOut: { path: 'logout', method: 'post' },        
       signUp: { path: 'register', method: 'post' },        
       getSession: { path: 'session', method: 'get' }    
}

Perhaps it has to become the default values ?

It seems to be linked to the modifications for this issue #742 ,
https://github.com/sidebase/nuxt-auth/pull/750/files , joinPathToApiURL function

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

Labels

documentationA change to the documentationp4Important Issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions