Open
Description
What is the improvement or update you wish to see?
The documentation doesn't explain how to test a route handler protected using the auth()
handler as it is suggested.
Is there any context that might help us understand?
I've implemented a test site, see the repo, to prove it.
The /api/protected
route (here) is using the auth()
handler and as it's seen in the test (here), needs to somehow create a request that auth()
could handle.
The usual test, see it here doesn't work. auth()
is neither accepting a NextRequest
nor responding a NextReponse
.
The documentation should add an example of how it can be done.
Does the docs page already exist? Please link to it.
https://authjs.dev/getting-started/session-management/protecting#api-routes