Registry / auth-security / ng-awesome-node-auth

ng-awesome-node-auth

JSON →
library1.8.4jsnpmunverified

Angular (v21+) standalone library providing interceptors, guards, and session management for backends using awesome-node-auth. v1.8.4, actively maintained. Key differentiators: fully tree-shakable, reactive signals for user state, smart guards (authGuard/guestGuard), automatic CSRF protection, optional UI sync for themes and feature flags, and SSR compatibility. Integrates seamlessly with Angular 21's standalone APIs via provideAuth and provideAuthUi providers.

npm install ng-awesome-node-auth
INSTALL
IMPORT
SIG · NG-AWESOME-NODE-AU
N
ng-awesome-node-auth
auth-securityjavascriptv1.8.4
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.

provideAuth
import { provideAuth } from 'ng-awesome-node-auth'
import { provideAuth } from 'ng-awesome-node-auth/';
ESM only; use named import. ensure path does not include trailing slash.
authGuard
import { authGuard } from 'ng-awesome-node-auth'
import AuthGuard from 'ng-awesome-node-auth'
authGuard is a named export, not a default export. Also available: guestGuard.
UiConfigService
import { UiConfigService } from 'ng-awesome-node-auth'
import { UiConfigService } from 'ng-awesome-node-auth/ui'
UiConfigService is re-exported from the main package, not a separate subpath.
provideAuthUi
import { provideAuthUi } from 'ng-awesome-node-auth'
import { provideAuthUi } from 'ng-awesome-node-auth/core'
provideAuthUi is a top-level export from the package.
user
import { user } from 'ng-awesome-node-auth'
import { user } from 'ng-awesome-node-auth/signals'
user is a signal function exported from the main package.

Shows how to configure ng-awesome-node-auth in an Angular 21 application using provideAuth and provideAuthUi, and protects routes with authGuard and guestGuard.

import { ApplicationConfig } from '@angular/core'; import { provideRouter } from '@angular/router'; import { provideAuth, provideAuthUi, authGuard, guestGuard } from 'ng-awesome-node-auth'; import { LoginComponent, DashboardComponent } from './components'; export const appConfig: ApplicationConfig = { providers: [ provideRouter([ { path: 'login', component: LoginComponent, canActivate: [guestGuard] }, { path: 'dashboard', component: DashboardComponent, canActivate: [authGuard] } ]), provideAuth({ apiPrefix: '/api/auth' }), provideAuthUi(), ] };
Debug
Known issues
breakingMinimum Angular version 21.2.0 is required.
fix
Upgrade to Angular 21.2.0 or later.
affects: <1.0.0
gotchaprovideAuth() must be called exactly once per application; calling it multiple times may cause token refresh conflicts.
fix
Ensure provideAuth is only provided in the root ApplicationConfig.
affects: >=1.0.0
gotchaThe interceptors only attach tokens to requests matching the configured apiPrefix; other requests are ignored.
fix
Set apiPrefix to match your backend's authentication endpoints, e.g., '/api/auth'.
affects: >=1.0.0
deprecatedUsing the library with Angular 20 or below is not supported; peer dependencies enforce Angular 21.
fix
Use an older version (<1.0.0) if you must stay on Angular 20, but no support is guaranteed.
affects: <1.0.0
Errors
Common errors & fixes
NullInjectorError: No provider for _HttpClient!
Missing HttpClientModule or provideHttpClient() in the app providers.
fix
Add provideHttpClient() in your app.config.ts: import { provideHttpClient } from '@angular/common/http'; then add to providers array.
TypeError: Cannot read properties of undefined (reading 'pipe')
Attempting to use the library without appropriate Angular version or missing peer dependencies.
fix
Ensure @angular/core and @angular/common are at version ^21.2.0 and run 'npm install' again.
Cannot find module 'ng-awesome-node-auth' or its corresponding type declarations.
Package not installed or missing from node_modules.
fix
Run 'npm install ng-awesome-node-auth' and verify your tsconfig.json includes 'node_modules' in 'moduleResolution'.
Upgrade
Version history
1.8.4latest on npm
Audit
Dependencies
@angular/commonrequiredPeer dependency for Angular common utilities
@angular/corerequiredPeer dependency for Angular core framework
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
ng-awesome-node-auth — npm install ng-awesome-node-auth · libregistry