|
1 | 1 | # nextjs-basic-auth-middleware |
2 | 2 |
|
3 | | -> :warning: Please upgrade to v2 if you use Next.js middleware version, v1 is broken. SSR Middleware for Next <=11 is still available on v1. |
| 3 | + |
4 | 4 |
|
5 | 5 | Adds basic auth support to Next.js projects using the official middleware approach (with a `middleware` file). |
6 | 6 | Options can be set on the basic auth middleware and overridden using environment variables. |
7 | 7 |
|
| 8 | +## Compatibility table |
| 9 | + |
| 10 | +| Next.js version | Plugin version | |
| 11 | +| --------------- | -------------- | |
| 12 | +| Next.js 13 | 3.x | |
| 13 | +| Next.js 12 | 2.x | |
| 14 | +| Next.js 10,11 | 1.x | |
| 15 | + |
| 16 | + |
8 | 17 | ## Installation |
9 | 18 |
|
10 | 19 | Run either of the following commands to add the package, based on your package manager of choice: |
@@ -57,10 +66,6 @@ You can also use the `nextBasicAuthMiddleware` function to check basic auth in a |
57 | 66 | > :warning: The middleware will still return a 401 and will quit processing the rest of the middleware. Add this middleware after any required work. |
58 | 67 |
|
59 | 68 |
|
60 | | -### Original SSR approach |
61 | | - |
62 | | -Please check `1.0.0` if you want to use this, this is no longer available in version >=2 |
63 | | - |
64 | 69 | ### Setting environment variables |
65 | 70 | If you want to override credentials you can use the `BASIC_AUTH_CREDENTIALS` environment variable: |
66 | 71 |
|
@@ -93,23 +98,4 @@ field | description | type |
93 | 98 | `password`| The password | `string` |
94 | 99 |
|
95 | 100 |
|
96 | | -## Local Development |
97 | | - |
98 | | -Below is a list of commands you will probably find useful. |
99 | | - |
100 | | -### `npm start` or `yarn start` |
101 | | - |
102 | | -Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for your convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab. |
103 | | - |
104 | | -Your library will be rebuilt if you make edits. |
105 | | - |
106 | | -### `npm run build` or `yarn build` |
107 | | - |
108 | | -Bundles the package to the `dist` folder. |
109 | | -The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module). |
110 | | - |
111 | | -### `npm test` or `yarn test` |
112 | | - |
113 | | -Runs the test watcher (Jest) in an interactive mode. |
114 | | -By default, runs tests related to files changed since the last commit. |
115 | 101 |
|
0 commit comments