Registry / auth-security / angular-auth-oidc-client

angular-auth-oidc-client

JSON →
library21.0.1jsnpmunverified

Angular library for OpenID Connect and OAuth2 authentication. Version 21.0.1 supports Angular 20+. Certified by OpenID Foundation, implements Code Flow with PKCE, Implicit Flow, Session Management, Token Revocation, and Pushed Authorisation Requests. Ships TypeScript types and supports schematics via ng add. Active development with frequent releases following Angular versions. Differentiator: full OIDC certification and comprehensive Angular integration including guards, interceptors, and session management.

npm install angular-auth-oidc-client
INSTALL
IMPORT
SIG · ANGULAR-AUTH-OIDC-
A
angular-auth-oidc-client
auth-securityjavascriptv21.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

AuthModule
import { AuthModule } from 'angular-auth-oidc-client'
import AuthModule from 'angular-auth-oidc-client'
Named export. ForRoot configuration required.
OidcConfiguration
import { OidcConfiguration } from 'angular-auth-oidc-client'
import { OidcConfig } from 'angular-auth-oidc-client'
Type for configuration object.
AuthService
import { AuthService } from 'angular-auth-oidc-client'
import { AuthService } from 'angular-auth-oidc-client/src/auth.service'
Main service for authentication operations.
LogLevel
import { LogLevel } from 'angular-auth-oidc-client'
Enum for log level configuration.
OidcSecurityService
import { OidcSecurityService } from 'angular-auth-oidc-client'
import { OidcSecurityService } from 'angular-auth-oidc-client/src/oidc-security.service'
Deprecated alias for AuthService since v20.
AuthResult
import { AuthResult } from 'angular-auth-oidc-client'
import { AuthResult } from 'angular-auth-oidc-client/auth-helper'
Type for authentication result. Exported since v20.0.1.

Shows basic configuration of AuthModule with forRoot and a simple login button in a component.

import { NgModule } from '@angular/core'; import { AuthModule, LogLevel } from 'angular-auth-oidc-client'; @NgModule({ imports: [ AuthModule.forRoot({ config: { authority: 'https://your-identity-server.com', redirectUrl: window.location.origin + '/callback', clientId: 'your-client-id', scope: 'openid profile email offline_access', responseType: 'code', silentRenew: true, useRefreshToken: true, logLevel: LogLevel.Debug, secureRoutes: ['/api', '/protected'], }, }), ], providers: [], }) export class AppModule {}; // In component: import { Component } from '@angular/core'; import { AuthService } from 'angular-auth-oidc-client'; @Component({ selector: 'app-root', template: '<button (click)="login()">Login</button>' }) export class AppComponent { constructor(private authService: AuthService) {} login(): void { this.authService.authorize(); } }
Debug
Known issues
breakingSince v20.0.0, strict issuer validation is enabled by default. This may break connections to OIDC providers with mismatched issuer.
fix
Set config.strictWellKnownIssuerValidation = false if your IDP is misconfigured.
affects: >=20.0.0
breakingOidcSecurityService is deprecated since v20.0.0 and scheduled for removal.
fix
Use AuthService instead.
affects: >=20.0.0
deprecatedAuthResult type was missing in v20.0.0 export. Re-exported in v20.0.1.
fix
Upgrade to v20.0.1 or later.
affects: 20.0.0
gotchaThe library uses sessionStorage by default unless configured otherwise. Clearing browser storage may log users out unexpectedly.
fix
Use config.storage = localStorage if needed, or implement custom storage.
affects: all
gotchaIf you disable PKCE with disablePkce=true, but the IDP requires PKCE, authentication will fail.
fix
Enable PKCE (default) unless your IDP does not support it.
affects: all
gotchaSilent renew iframe may not work in some browsers due to third-party cookie restrictions.
fix
Consider using popup or refresh token flow instead.
affects: all
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'authorize')
AuthService not properly injected, possibly due to missing AuthModule.forRoot.
fix
Ensure AuthModule.forRoot() is imported in your AppModule.
Error: Configuration 'your-config-id' not found.
Providing a configId in authorize() that does not match any configuration.
fix
Check the configId parameter matches the one defined in AuthModule.forRoot().
Error: The issuer is not valid (strict issuer validation).
OIDC well-known endpoint returns an issuer mismatch.
fix
Set strictWellKnownIssuerValidation: false in config or correct the authority URL.
ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'access_token')
AuthResult not handled correctly; access_token may be undefined if authentication failed.
fix
Check the isAuthenticated flag in AuthResult before accessing token properties.
Upgrade
Version history
21.0.1latest on npm
Audit
Dependencies
@angular/corerequiredPeer dependency for Angular integration
@angular/commonrequiredPeer dependency for Angular common utilities
@angular/routerrequiredPeer dependency for Angular routing and guards
rxjsrequiredPeer dependency for reactive programming
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
angular-auth-oidc-client — npm install angular-auth-oidc-client · libregistry