V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
W4J1e
V2EX  ›  程序员

[求助]如何使第三方应用登陆的微软账户认证信息持久化?

  •  
  •   W4J1e · Nov 20, 2025 · 1025 views
    This topic created in 168 days ago, the information mentioned may be changed or developed.

    说起来让大家见笑,我不是程序员,也没专门学过编程开发。前段时间用 AI 写了 next.js 的导航页,通过登陆微软账户,使用 onedrive 同步个性化更改,目前部署在 edgeone pages 上面。

    但是我尝试过很多次,AI 也改了很多次,认证 cookies 设置了 7 天的有效期,但是现在登陆成功后,过几个小时登陆信息依然会失效。恳请大哥们有时间的话帮忙看看,给出指导意见,谢谢。

    // 设置认证 Cookie
    export function setAuthCookie(res: NextResponse, token: string, request?: NextRequest): void {
      const cookieOptions: any = {
        httpOnly: true,
        secure: process.env.NODE_ENV === 'production',
        sameSite: 'lax',
        maxAge: 7 * 24 * 60 * 60 * 1000, // 7 天
        path: '/'
      };
    

    仓库: https://github.com/W4J1e/SimpleNav/blob/2b6a2a354c3ac79a845fd8ae0dd787a310b66076/src/lib/auth.ts#L224

    Supplement 1  ·  Nov 29, 2025
    在几天前已解决。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   930 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:13 · PVG 05:13 · LAX 14:13 · JFK 17:13
    ♥ Do have faith in what you're doing.