fix middle 103
This commit is contained in:
15
src/app/api/middleware/route.ts
Normal file
15
src/app/api/middleware/route.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { cookies } from "next/headers";
|
||||
import "colors";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
// const token = req.headers.get("Authorizationx")?.split(" ")[1];
|
||||
const token = cookies().get("hipmi-key")?.value;
|
||||
|
||||
return new Response(token, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Cache-Control": "no-store",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const auth = req.headers.get("Authorization");
|
||||
const token = auth?.split(" ")[1];
|
||||
|
||||
console.log("Token received in API Validation:", token , `<<<<<<<<<<<<<<<`);
|
||||
console.log("Authorization header:", auth, `<--------`);
|
||||
const token = req.headers.get("Authorization")?.split(" ")[1];
|
||||
console.log("Token received in API Validation:", token, `<<<<<<<<<<<<<<<`);
|
||||
|
||||
if (!token) return NextResponse.json({ success: false }, { status: 401 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user