
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
alp-browser-auth
Advanced tools
authentication with alp
npm install --save alp-node-auth
context.state.connected and context.state.userconfig/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 'alp-node/fetch';
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 T from 'react-alp-translate';
import { Helmet } from 'alp-react';
import { LoginButtons } from 'react-alp-login';
import Header from '../components/HeaderComponent';
export default (): ReactNode => (
<div className="login-view">
<T id="title">{title => <Helmet title="Login" titleTemplate={`${title} - %s`} />}</T>
<Header />
<LoginButtons />
</div>
);
modules/common/components/HeaderUserComponent.js
import { ReactNode } from 'react';
import Link from 'react-alp-link';
import User from 'react-alp-user';
import T from 'react-alp-translate';
<User>
{user => (
user ? (
<span className="dropdown">
{user.displayName}
<ul className="list links">
<li>
<T id="header.logout">{t =>
<Link to="logout" target="_self">{t}</Link>
}</T>
</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-browser-auth receives a total of 0 weekly downloads. As such, alp-browser-auth popularity was classified as not popular.
We found that alp-browser-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
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

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.