
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
alp-node-auth
Advanced tools
authentication with alp
npm install --save alp-node-auth
context.state.loggedInUserId and context.state.loggedInUserconfig/local.yml
server:
google:
clientId: xxxx
clientSecret: xxxx
models/user/usersManager.server.js
import MongoStore from "../../db/mongo";
import { UsersManager } from "alp-node-auth";
export default new UsersManager(new MongoStore("users"));
index.server.js
import Alp from 'alp-node';
import authInit from 'alp-node-auth';
import googleStrategy from 'alp-node-auth/strategies/google';
import * as loginModuleDescriptor from './modules/auth/login';
import usersManager from './models/user/usersManager.server';
const app = new Alp(...);
// config / init
const authMiddleware = authInit({
controllers,
usersManager,
strategies: { google: googleStrategy(config) },
loginModuleDescriptor,
})(app);
// middlewares
app.use(authMiddleware);
routerBuilder.js
import { routes as authRoutes } from "alp-node-auth";
export default function buildRouter(builder) {
builder
.add("home", "/", "home.index")
.add(...authRoutes.login)
.add(...authRoutes.logout)
.addDefaultRoutes();
}
modules/auth/login/index.js
export const identifier = "login";
export View from "./LoginView";
modules/auth/login/LoginView.js
import { ReactNode } from 'react';
import { LoginButtons } from 'react-alp-login';
import Header from '../components/HeaderComponent';
export default (): ReactNode => (
<div className="login-view">
<Helmet title="Login" titleTemplate={`${title} - %s`} />
<Header />
<LoginButtons />
</div>
);
modules/common/components/HeaderUserComponent.js
import { ReactNode } from 'react';
import Link from 'react-alp-link';
import User from 'react-alp-user';
<User>
{user => (
user ? (
<span className="dropdown">
{user.displayName}
<ul className="list links">
<li>
<Link to="logout" target="_self">Logout</Link>
</li>
</ul>
</span>
) : (
<div>
<T id="header.login">{t => (
<Link to="login" params={{ strategy: 'google' }} target="_self">{t}</Link>
)}</T>
</div>
)
)}
</User>
);
FAQs
authentication with alp
The npm package alp-node-auth receives a total of 28 weekly downloads. As such, alp-node-auth popularity was classified as not popular.
We found that alp-node-auth demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.