feat(auth): Add authorize page
This commit is contained in:
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function GET() {
|
||||
if (!process.env.SECNEX_API_HOST || !process.env.SECNEX_API_KEY) {
|
||||
if (!process.env.SECNEX_AUTH_API_HOST || !process.env.SECNEX_AUTH_API_KEY) {
|
||||
return NextResponse.json({ success: false, message: "SecNex API host or key is not set" });
|
||||
}
|
||||
const cookieStore = await cookies();
|
||||
@@ -12,12 +12,12 @@ export async function GET() {
|
||||
return NextResponse.json({ success: false, message: "No token found" });
|
||||
}
|
||||
console.log("Token found");
|
||||
const response = await fetch(`${process.env.SECNEX_API_HOST}/logout`, {
|
||||
const response = await fetch(`${process.env.SECNEX_AUTH_API_HOST}/logout`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ token: token.value }),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${process.env.SECNEX_API_KEY}`,
|
||||
"Authorization": `Bearer ${process.env.SECNEX_AUTH_API_KEY}`,
|
||||
},
|
||||
});
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user