
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
replit-auth
Advanced tools
A really optimized and simple replit authentication middleware for Express. The middleware can be applied to all routes or specific routes, and a custom login page can be used.
npm install replit-auth
const express = require('express');
const authMiddleware = require('replit-auth');
const app = express();
// Apply the middleware to all routes
authMiddleware(app);
// Apply the middleware to specific routes
const auth = authMiddleware(app, { allRoutes: false });
app.get('/protected', auth, (req, res) => {
res.send(`Hello, ${req.user.name}!`);
});
// Use a custom login page
authMiddleware(app, { customPage: '/path/to/custom/login.html' });
authMiddleware(app, options)
This function takes in an Express application instance and an options object.
app
(Express application instance): The Express application instance to which the middleware will be applied.options
(Object): An object containing optional parameters.
allRoutes
(Boolean): Whether auth should be applied on all routes or not. Defaults to true
.customPage
(String): Path to custom auth page file.If allRoutes
is false, returns an auth middleware function that can be used on specific routes. If allRoutes
is true, returns undefined
.
interface UserInfo {
id?: number;
name?: string;
bio?: string;
url?: string;
profileImage?: string;
roles?: string[];
teams?: string[];
[prop: string]: any;
}
FAQs
A really optimized and small express middleware for repl authentication.
The npm package replit-auth receives a total of 37 weekly downloads. As such, replit-auth popularity was classified as not popular.
We found that replit-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.