You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next 13 just dropped route handlers for app/ dir, which replace old API routes from pages/ directory. Right now this feature is available on next@canary.
Currently next-auth suggests us to create a pages/api/auth/[...nextauth].ts route, which will handle both UI and API for auth, basically all-in-one. app/ directory will require a new mental model for this, here's how I see it:
We will need to export GET and POST (and other methods if any) so that consumer can re-use them in route handlers
Preferably route handlers should use dynamic functions like headers and cookies so that NextJS can can correctly infer when to use dynamic rendering
The default UI that comes with next-auth should be available separately from route handlers
From the consumer point of view, this could look like this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Next 13 just dropped route handlers for
app/
dir, which replace old API routes frompages/
directory. Right now this feature is available onnext@canary
.Currently
next-auth
suggests us to create apages/api/auth/[...nextauth].ts
route, which will handle both UI and API for auth, basically all-in-one.app/
directory will require a new mental model for this, here's how I see it:GET
andPOST
(and other methods if any) so that consumer can re-use them in route handlersnext-auth
should be available separately from route handlersFrom the consumer point of view, this could look like this:
I wasn't sure if I should open an issue or discussion for this one, please let me know if I need to convert this to an issue instead.
Beta Was this translation helpful? Give feedback.
All reactions