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 };
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'INITIALIZE_APPLICATION')
AuthUtils.Notifications.INITIALIZE_APPLICATION may be undefined if authSagas not initialized.
fixEnsure 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.
fixAdd 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).
fixInstall connected-react-router@6.9.0 with npm install connected-react-router@6.9.0.
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