小编Rag*_*hav的帖子

当我在下一个身份验证的提供者中选择凭据时,如何同步下一个身份验证会话的过期时间和来自服务器的令牌

我已经为我的 Next.js 应用程序实现了 next-auth 身份验证系统。在提供程序中,我选择了凭据,因为我有一个 Node.js 后端服务器。

我面临的问题是下一个身份验证会话的到期时间与我后端的 jwt 令牌的到期时间不同步。这会导致不一致。请帮助我。

下面是我的下一个授权代码

import NextAuth, {
  NextAuthOptions,
  Session,
  SessionStrategy,
  User,
} from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import { login } from "@actions/auth";
import { toast } from "react-toastify";
import { JWT } from "next-auth/jwt";
import { NextApiRequest, NextApiResponse } from "next";
import { SessionToken } from "next-auth/core/lib/cookie";

// For more information on each option (and a full list of options) go to
// https://next-auth.js.org/configuration/options
const nextAuthOptions = (req: NextApiRequest, res: NextApiResponse) …
Run Code Online (Sandbox Code Playgroud)

session node.js jwt next.js next-auth

18
推荐指数
2
解决办法
3万
查看次数

标签 统计

jwt ×1

next-auth ×1

next.js ×1

node.js ×1

session ×1