Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] 405 response in /_auth/session #361

Open
valentimarco opened this issue Feb 23, 2025 · 1 comment
Open

[Bug] 405 response in /_auth/session #361

valentimarco opened this issue Feb 23, 2025 · 1 comment

Comments

@valentimarco
Copy link

valentimarco commented Feb 23, 2025

Description

I am creating a simple page like so:
Auth page
register endpoint
Override Types

But after the response from the register endpoint, i get a 405 from api/_auth/session. If i try to call the endpoint with curl i get the same response (maybe is intended idk).

What i am using

Using bun and vscode ssh remote connection. The project is not inside a container!
Using the latest verision of the package

                     ./o.                   marco@marco-ArchServer
                   ./sssso-                 ----------------------
                 `:osssssss+-               OS: EndeavourOS x86_64
               `:+sssssssssso/.             Host: B450M DS3H
             `-/ossssssssssssso/.           Kernel: Linux 6.6.72-1-lts
           `-/+sssssssssssssssso+:`         Uptime: 8 days, 8 hours, 42 mins
         `-:/+sssssssssssssssssso+/.        Packages: 727 (pacman)
       `.://osssssssssssssssssssso++-       Shell: zsh 5.9
      .://+ssssssssssssssssssssssso++:      Cursor: Adwaita
    .:///ossssssssssssssssssssssssso++:     Terminal: /dev/pts/0
  `:////ssssssssssssssssssssssssssso+++.    CPU: AMD Ryzen 5 2600 (12) @ 3.40 GHz
`-////+ssssssssssssssssssssssssssso++++-    GPU: NVIDIA GeForce GTX 960 [Discrete]
 `..-+oosssssssssssssssssssssssso+++++/`    Memory: 2.56 GiB / 15.56 GiB (16%)
   ./++++++++++++++++++++++++++++++/:.      Swap: 439.50 MiB / 8.80 GiB (5%)
  `:::::::::::::::::::::::::------``        Disk (/): 43.69 GiB / 99.85 GiB (44%) - ext4
@valentimarco
Copy link
Author

I resolve by copy paste this code from the playground into server/plugins/session.ts:

export default defineNitroPlugin(() => {
  sessionHooks.hook('fetch', async (session) => {
    // Extend User Session
    // Or throw createError({ ... }) if session is invalid
    session.extended = {
      fromHooks: true,
    }
  })

  sessionHooks.hook('clear', async (_session) => {
    // Log that user logged out
    console.log('User logged out')
  })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant