Skip to content

Instantly share code, notes, and snippets.

View jvgrootveld's full-sized avatar

Justin van Grootveld jvgrootveld

View GitHub Profile
@jvgrootveld
jvgrootveld / nextjs-firebase-admin-sdk-api-auth-middleware.ts
Last active July 18, 2023 13:37
API Auth middleware for NextJS with firebase admin SDK as this does not work with _middleware files
import { auth } from '../../firebase/firebase-admin'
import { NextApiRequest, NextApiResponse } from 'next'
type NextContextApiHandler = (req: NextApiRequestWithContext, res: NextApiResponse) => Promise<void>
export interface Context {
uid: string
}
export interface NextApiRequestWithContext extends NextApiRequest {