Skip to content

Instantly share code, notes, and snippets.

View alabdulaal's full-sized avatar

Ahmed Al Abdulaal alabdulaal

View GitHub Profile
import { withAuthUserTokenSSR, AuthAction, type AuthUser } from "next-firebase-auth";
import { NextApiRequest, NextApiResponse } from "next";
const checkServerSideAuth =
typeof window !== "undefined"
? () => {} // "withAuthUserTokenSSR" can only be called server-side.
: withAuthUserTokenSSR({
whenAuthed: AuthAction.RENDER,
whenUnauthed: AuthAction.REDIRECT_TO_LOGIN,
authPageURL: "401",