
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@phntms/next-basic-auth
Advanced tools
Lightweight middleware to add basic-auth protection onto your Next.js site.
Lightweight middleware to add basic-auth protection onto your Next.js site.
Do you have a site that is still in development or need to protect non production environments? Then this basic library is for you. It allows you to protect all your pages in one go by adding this middleware to your _document
template.
Install this package with npm
.
npm i @phntms/next-basic-auth
import basicAuth from "@phntms/next-basic-auth";
import Document, {
DocumentContext,
Head,
Html,
Main,
NextScript,
} from "next/document";
const authConfig = {
name: "john",
pass: "letmein",
message: "Go away!",
};
export default class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
await basicAuth(ctx, authConfig);
}
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
ctx
: Required - The DocumentContext
provided by getInitialProps
.config
: Optional - BasicAuthMiddlewareConfig
object which allows you to change the default configuration.You can override the configuration using these options...
name
: The username required for login, defaults to admin
.pass
: The password required for login, defaults to password
.realm
: The realm used for the basic-auth, defaults to site
.message
: The message to show upon unsuccessful login, defaults to 401 Access Denied
.FAQs
Lightweight middleware to add basic-auth protection onto your Next.js site.
We found that @phntms/next-basic-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.