小编Abd*_*eer的帖子

下一个身份验证登录重定向到 /signin?csrf=true

我已经按照文档中的方式实现了 next-auth,当我访问 http://localhost:3001/api/auth/signin 时,我看到了这个 在此输入图像描述

之后,当我单击“使用 google 或 github 登录”时,我的页面会刷新并被重定向到http://localhost:3001/api/auth/signin?csrf=true之后没有任何反应。它是同一页面。

我的 [...nextauth.js] 文件

    import NextAuth from "next-auth";
import Providers from "next-auth/providers";

export default NextAuth({
    providers: [
        Providers.Google({
            clientId: process.env.GOOGLE_CLIENT,
            clientSecret: process.env.GOOGLE_KEY,
        }),
        Providers.GitHub({
            clientId: process.env.GITHUB_CLIENT,
            clientSecret: process.env.GITHUB_SECRET,
        }),
    ],
});
Run Code Online (Sandbox Code Playgroud)

任何想法,为什么它不起作用

我认为它与我的节点表达服务器有关,其代码是

const express = require("express");
const app = express();
const server = require("http").createServer(app);
const next = require("next");
const nextApp = next({ dev: true });
const nextHandler = nextApp.getRequestHandler();


/*******************ROUTES****************/
const userRoutes = require("./server/routes/user");

nextApp.prepare().then(() => {
    app.use("/node/user", userRoutes); …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs next.js next-auth

5
推荐指数
1
解决办法
2341
查看次数

标签 统计

javascript ×1

next-auth ×1

next.js ×1

reactjs ×1