mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-17 14:33:41 +08:00
认证中间状态
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user