Fix Deployment Authentication Problems #18

Merged
LAX18 merged 2 commits from main into main 2024-02-20 11:49:23 -10:00
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import { getDatabase, ref, set as firebaseSet } from "firebase/database";
async function onboard(firstName, lastName, req) {
var session = req.cookies.get("session");
//Call the authentication endpoint
var res = await fetch("http://localhost:3000/api/login", {headers: {Cookie: `session=${session?.value}`}})
var res = await fetch(new URL("/api/login", req.url), {headers: {Cookie: `session=${session?.value}`}})
// Login if unauthorized
if (res.status !== 200) {
+1 -1
View File
@@ -10,7 +10,7 @@ export async function middleware(req, res) {
return NextResponse.redirect(new URL("/login", req.url));
}
//Call the authentication endpoint
const responseAPI = await fetch("http://localhost:3000/api/login", {
const responseAPI = await fetch(new URL("/api/login", req.url), {
headers: {
Cookie: `session=${session?.value}`,
},