https://github.com/iansu/vercel-middleware-auth-demo
An example that shows how you can use Vercel Middleware to control access to an app
https://github.com/iansu/vercel-middleware-auth-demo
Last synced: about 2 months ago
JSON representation
An example that shows how you can use Vercel Middleware to control access to an app
- Host: GitHub
- URL: https://github.com/iansu/vercel-middleware-auth-demo
- Owner: iansu
- Created: 2022-09-14T20:07:54.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-14T21:10:16.000Z (almost 4 years ago)
- Last Synced: 2025-08-26T01:27:39.632Z (11 months ago)
- Language: TypeScript
- Homepage: vercel-middleware-auth-demo.vercel.app
- Size: 47.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vercel Middleware Auth Demo
An example that shows how you can use [Vercel Middleware](https://nextjs.org/docs/advanced-features/middleware) to control access to an app
> **Warning**
> This only provides limited protection and it's easy for users to duplicate the auth cookie. Make sure you understand the risks and tradeoffs before using this in a production application.
This repo includes two apps:
- [Dashboard](./apps/dashboard): An app that you want to password protect
- [Auth](./apps/auth): An app that takes a password and sets a cookie to grant access to the dashboard
## Demo
[https://dashboard.vercel-middleware-auth-demo.iansutherland.dev](https://dashboard.vercel-middleware-auth-demo.iansutherland.dev)
You should be asked to login and then redirected back to the dashboard app. You can login with the passwords `password` and `secret`.
## Development
1. Run `npm install`
1. In one terminal window run `npm start -w auth`
1. In another terminal window run `npm start -w dashboard`
1. Go to [http://localhost:3000](http://localhost:3000)