This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use this edge middleware anywhere in your pages directory to prevent unauthorized access. | |
* in this case we prevent access to certain pages without the author role present on the token. | |
* Make sure the token is present on req.cookies by setting it on the client side or posting to a server side endpoint | |
* and setting refresh token via firebase admin SDK. See https://firebase.google.com/docs/auth/admin/manage-cookies | |
* Be sure to rotate tokens frequently on client or server. | |
*/ | |
// eslint-disable-next-line @next/next/no-server-import-in-page | |
import { NextFetchEvent, NextRequest, NextResponse } from "next/server"; |
NewerOlder