Sey*_*eyT 4 next.js next-auth next.js13
目前pages/api/auth目录下的[\xe2\x80\xa6nextauth].ts文件工作正常。但是,我想迁移到 Next.js 13.2\xe2\x80\x99s 应用程序目录 API 路由,但无法\xe2\x80\x99t 找到迁移我的 nextAuth 路由的方法。我尝试将 /pages/api/auth/[\xe2\x80\xa6nextauth].ts 移动到 app/api/auth/[\xe2\x80\xa6nextauth].ts 但它\xe2\x80\x99s 不起作用。
\n小智 6
next-auth 文档建议Next 13.2+使用以下方法
/app/api/auth/[...nextauth]/route.ts <- file strucure
import NextAuth from "next-auth"
const handler = NextAuth({
...
})
export { handler as GET, handler as POST }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4303 次 |
| 最近记录: |