QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.84k stars 1.31k forks source link

[🐞] @auth/qwik package does not correctly register routes #6729

Closed cwoolum closed 3 months ago

cwoolum commented 3 months ago

Which component is affected?

Qwik Runtime

Describe the bug

When trying to use the @auth/qwik package, routes are not getting registered which causes auth redirects to fail with the error /api/auth/signin not found.

image

Reproduction

https://stackblitz.com/edit/qwik-starter-7tnnx2

Steps to reproduce

  1. Create a new Qwik app
  2. Add auth
  3. Convert to using @auth/core instead of @builder.io/qwik-auth in plugin@auth.ts.
  4. Add an onRequest handler to redirect if a user is unauthenticated

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @auth/core: ^0.13.0 => 0.13.0 
    @auth/qwik: ^0.2.2 => 0.2.2 
    @builder.io/qwik: ^1.4.3 => 1.4.3 
    @builder.io/qwik-auth: 0.1.1 => 0.1.1 
    @builder.io/qwik-city: ^1.4.3 => 1.4.3 
    typescript: 5.3.3 => 5.3.3 
    undici: 5.28.2 => 5.28.2 
    vite: 4.5.2 => 4.5.2

Additional Information

No response

cwoolum commented 3 months ago

Dug a bit deeper and as per the source, the auth routes no longer live under /api. I'll get a PR up to fix the docs.

gioboa commented 3 months ago

Thanks @cwoolum nice catch The basePath is /auth here is the code I'm looking forward to merging your PR