Skip to content

Instantly share code, notes, and snippets.

View gavinharris-dev's full-sized avatar
🐍

Gavin Harris gavinharris-dev

🐍
View GitHub Profile
@gavinharris-dev
gavinharris-dev / TestPage.tsx
Created September 4, 2021 23:25
withVerifiedEmail handler example
export const TestPage: FC<TestPageProps> = ({ }) => {
}
export const getServerSideProps = withAuthUserSSR({
authPageURL: '/login',
whenUnauthed: AuthAction.REDIRECT_TO_LOGIN,
})(async (props) => {
return withVerifiedEmail(props, '/verifyEmail', async () => {
@gavinharris-dev
gavinharris-dev / withAuthUserTokenAPI.ts
Created August 17, 2021 23:28
API Authentication Middleware for next-firebase-auth
import { NextApiRequest, NextApiResponse } from 'next';
import { AuthUser, verifyIdToken } from 'next-firebase-auth';
export interface AuthenticatedNextApiRequest extends NextApiRequest {
AuthUser?: AuthUser;
}
/**
* API Middleware for Firebase ID Token Authorization.
* API endpoints wrapped with this middleware will be required to be executes with a