Registry / security / lattice-auth

lattice-auth

JSON →
library0.29.0jsnpmunverified

JavaScript authentication helpers for OpenLattice, v0.29.0. Provides Redux-based auth flows (login, logout, token refresh) integrated with react-router and @redux-saga/core. Requires peer deps from OpenLattice ecosystem (lattice, immutable, lodash, luxon). Commonly used together with redux-saga and connected-react-router for managing auth state in React apps. Not standalone; tied to OpenLattice backend, not generic auth.

npm install lattice-auth
INSTALL
IMPORT
SIG · LATTICE-AUTH
L
lattice-auth
securityjavascriptv0.29.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthUtils
import { AuthUtils } from 'lattice-auth';
const AuthUtils = require('lattice-auth');
ESM-only; no CommonJS support.
authSagas
import { authSagas } from 'lattice-auth';
import authSagas from 'lattice-auth';
Named export, not default.
AuthReducer
import { authReducer, AuthReducer } from 'lattice-auth';
import { AuthReducer } from 'lattice-auth/authReducer';
Named export from package root; not a subpath.

Sets up Redux store with authReducer and authSagas, using connected-react-router and @redux-saga/core.

import { createStore, applyMiddleware, compose } from 'redux'; import createSagaMiddleware from '@redux-saga/core'; import { connectRouter, routerMiddleware } from 'connected-react-router'; import { createBrowserHistory } from 'history'; import { authReducer, authSagas } from 'lattice-auth'; import { combineReducers } from 'redux-immutable'; const history = createBrowserHistory(); const sagaMiddleware = createSagaMiddleware(); const routerMid = routerMiddleware(history); const rootReducer = combineReducers({ router: connectRouter(history), auth: authReducer, }); const store = createStore( rootReducer, compose(applyMiddleware(routerMid, sagaMiddleware)) ); sagaMiddleware.run(authSagas); export { store, history };
Debug
Known issues
breakingPeer dep @redux-saga/core >=1.1.0 not compatible with redux-saga <1.0.0.
fix
Install @redux-saga/core instead of redux-saga.
affects: >=0.29.0
gotchaRequires immutable.js 4.0.0-rc.10 exactly; other versions may cause runtime errors.
fix
Pin immutable to 4.0.0-rc.10 in package.json.
affects: >=0.29.0
gotchaAuthSagas must be run with sagaMiddleware.run(authSagas) after store creation; otherwise sagas won't start.
fix
Ensure run is called after store creation.
affects: >=0.29.0
deprecatedconnected-react-router v6.9.0 is required but may conflict with react-router v6; this package uses react-router v5.x.
fix
Keep react-router-dom at v5.x.
affects: >=0.29.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'INITIALIZE_APPLICATION')
AuthUtils.Notifications.INITIALIZE_APPLICATION may be undefined if authSagas not initialized.
fix
Ensure store created and sagaMiddleware.run(authSagas) executed before dispatching auth actions.
Error: Actions must be plain objects. Use custom middleware for async actions.
Calling AuthUtils.login (which dispatches a saga action) without having saga middleware installed.
fix
Add applyMiddleware(sagaMiddleware) when creating store.
Cannot find module 'connected-react-router' or its corresponding type declarations.
Missing peer dependency or using wrong version (v6 needed).
fix
Install connected-react-router@6.9.0 with npm install connected-react-router@6.9.0.
Upgrade
Version history
0.29.0latest on npm
Audit
Dependencies
reduxrequiredstate management for auth tokens and user session
reactrequiredUI components for login/logout flows
react-reduxrequiredconnecting auth state to React components
@redux-saga/corerequiredside effect middleware for async auth operations
connected-react-routerrequiredroute synchronization with Redux store for auth redirects
immutablerequiredImmutable.js data structures used in auth state
latticerequiredcore Lattice SDK for API calls
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
lattice-auth — npm install lattice-auth · libregistry