认证中间状态

This commit is contained in:
sijinhui
2024-04-01 23:29:41 +08:00
parent f5874a4d3d
commit f686fe09ce
7 changed files with 28 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
import { NextRequest, NextResponse } from "next/server";
import { getSession } from "@/lib/auth";
import { VerifiedUser } from "@/lib/auth";
import { getServerSideConfig } from "@/app/config/server";
const serverConfig = getServerSideConfig();
// Gets an access token.
@@ -21,9 +21,8 @@ async function handle(
) {
// 认证
const session = await getSession();
if (!session?.user)
return NextResponse.json({ error: "未认证" }, { status: 401 });
const isUser = await VerifiedUser();
if (!isUser) return NextResponse.json({ error: "未认证" }, { status: 401 });
const get_access_token = await getAccessToken();