# angular-auth-oidc-client

> Angular Lib for OpenID Connect & OAuth2

Latest version **22.0.0** (published 2026-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-auth-oidc-client
pnpm add angular-auth-oidc-client
yarn add angular-auth-oidc-client
bun add angular-auth-oidc-client
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 22.0.0 |
| Published | 2026-08-15 |
| First published | 2017-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 948.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1238 |
| Author | Damien Bowden & Fabian Gosebrink |
| Maintainers | damienbod, fabiangosebrink |
| Keywords | angular, oidc, oauth2, openid, security, typescript, openidconnect, auth, authn, authentication, identity, certified, oauth, authorization |

## Links

- npm: https://www.npmjs.com/package/angular-auth-oidc-client
- Repository: https://github.com/damienbod/angular-auth-oidc-client
- Issues: https://github.com/damienbod/angular-auth-oidc-client/issues
- npm.io page: https://npm.io/package/angular-auth-oidc-client

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0
- [rfc4648](https://npm.io/package/rfc4648.md) ^1.5.0

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 22.0.0 (latest) — 2026-08-15
- 21.0.3 — 2026-08-09
- 21.0.2 — 2026-05-01
- 21.0.1 — 2025-12-11
- 21.0.0 — 2025-12-01
- 20.0.3 — 2025-11-02
- 20.0.2 — 2025-09-24
- 20.0.1 — 2025-09-10
- 20.0.0 — 2025-09-07
- 19.0.2 — 2025-07-22
- 19.0.1 — 2025-05-11
- 19.0.0 — 2024-12-04
- 18.0.2 — 2024-10-12
- 16.0.2 — 2024-06-26
- 18.0.1 — 2024-06-20
- … 175 more at https://npm.io/package/angular-auth-oidc-client/versions

## README

# Angular Lib for OpenID Connect & OAuth2

![Build Status](https://github.com/damienbod/angular-auth-oidc-client/actions/workflows/build.yml/badge.svg?branch=main) [![npm](https://img.shields.io/npm/v/angular-auth-oidc-client.svg)](https://www.npmjs.com/package/angular-auth-oidc-client) [![npm](https://img.shields.io/npm/dm/angular-auth-oidc-client.svg)](https://www.npmjs.com/package/angular-auth-oidc-client) [![npm](https://img.shields.io/npm/l/angular-auth-oidc-client.svg)](https://www.npmjs.com/package/angular-auth-oidc-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Coverage Status](https://coveralls.io/repos/github/damienbod/angular-auth-oidc-client/badge.svg?branch=main)](https://coveralls.io/github/damienbod/angular-auth-oidc-client?branch=main)

<p align="center">
  <a href="https://angular-auth-oidc-client.com/"><img src="https://raw.githubusercontent.com/damienbod/angular-auth-oidc-client/main/.github/angular-auth-logo.png" alt="" width="350" /></a>
</p>

Secure your Angular app using the latest standards for OpenID Connect & OAuth2. Provides support for token refresh, all modern OIDC Identity Providers and more.

## Acknowledgements

This library is <a href="http://openid.net/certification/#RPs">certified</a> by OpenID Foundation. (RP Implicit and Config RP)

<p align="center">
  <a href="http://openid.net/certification/#RPs"><img src="https://damienbod.files.wordpress.com/2017/06/oid-l-certification-mark-l-rgb-150dpi-90mm.png" alt="" width="400" /></a>
</p>

## Features

- [Code samples](https://angular-auth-oidc-client.com/docs/samples/) for most of the common use cases
- Supports schematics via `ng add` support
- Supports all modern OIDC identity providers
- Supports OpenID Connect Code Flow with PKCE
- Supports Code Flow PKCE with Refresh tokens
- [Supports OpenID Connect Implicit Flow](http://openid.net/specs/openid-connect-implicit-1_0.html)
- [Supports OpenID Connect Session Management 1.0](http://openid.net/specs/openid-connect-session-1_0.html)
- [Supports RFC7009 - OAuth 2.0 Token Revocation](https://tools.ietf.org/html/rfc7009)
- [Supports RFC7636 - Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636)
- [Supports OAuth 2.0 Pushed authorisation requests (PAR) draft](https://tools.ietf.org/html/draft-ietf-oauth-par-06)
- Semantic releases
- Github actions
- Modern coding guidelines with prettier, husky
- Up to date documentation
- Implements OIDC validation as specified, complete client side validation for REQUIRED features
- Supports authentication using redirect or popup

## Installation

### Ng Add

You can use the schematics and `ng add` the library.

```shell
ng add angular-auth-oidc-client
```

And answer the questions. A module will be created which encapsulates your configuration.

![angular-auth-oidc-client schematics](https://raw.githubusercontent.com/damienbod/angular-auth-oidc-client/main/.github/angular-auth-oidc-client-schematics-720.gif)

### Npm / Yarn

Navigate to the level of your `package.json` and type

```shell
 npm install angular-auth-oidc-client
```

or with yarn

```shell
 yarn add angular-auth-oidc-client
```

## Documentation

[Read the docs here](https://angular-auth-oidc-client.com/)

## Samples

[Explore the Samples here](https://angular-auth-oidc-client.com/docs/samples/)

## Quickstart

For the example of the Code Flow. For further examples please check the [Samples](https://angular-auth-oidc-client.com/docs/samples/) Section.

> If you have done the installation with the schematics, these modules and files should be available already!

### Configuration

Import the `AuthModule` in your module.

```ts
import { NgModule } from '@angular/core';
import { AuthModule, LogLevel } from 'angular-auth-oidc-client';
// ...

@NgModule({
  // ...
  imports: [
    // ...
    AuthModule.forRoot({
      config: {
        authority: '<your authority address here>',
        redirectUrl: window.location.origin,
        postLogoutRedirectUri: window.location.origin,
        clientId: '<your clientId>',
        scope: 'openid profile email offline_access',
        responseType: 'code',
        silentRenew: true,
        useRefreshToken: true,
        logLevel: LogLevel.Debug,
      },
    }),
  ],
  // ...
})
export class AppModule {}
```

When using `silentRenew` together with `useRefreshToken`, requesting the
`offline_access` scope is common and remains the default recommendation.
Some providers support refresh token renewal in the browser without
`offline_access`. In those cases, you can suppress the configuration warning
with `disableRefreshTokenOfflineAccessScopeWarning: true`.

And call the method `checkAuth()` from your `app.component.ts`. The method `checkAuth()` is needed to process the redirect from your Security Token Service and set the correct states. This method must be used to ensure the correct functioning of the library.

```ts
import { Component, OnInit, inject } from '@angular/core';
import { OidcSecurityService } from 'angular-auth-oidc-client';

@Component({
  /*...*/
})
export class AppComponent implements OnInit {
  private readonly oidcSecurityService = inject(OidcSecurityService);

  ngOnInit() {
    this.oidcSecurityService.checkAuth().subscribe((loginResponse: LoginResponse) => {
      const { isAuthenticated, userData, accessToken, idToken, configId } = loginResponse;

      /*...*/
    });
  }

  login() {
    this.oidcSecurityService.authorize();
  }

  logout() {
    this.oidcSecurityService.logoff().subscribe((result) => console.log(result));
  }
}
```

### Using the access token

You can get the access token by calling the method `getAccessToken()` on the `OidcSecurityService`

```ts
const token = this.oidcSecurityService.getAccessToken().subscribe(...);
```

And then you can use it in the HttpHeaders

```ts
import { HttpHeaders } from '@angular/common/http';

const token = this.oidcSecurityServices.getAccessToken().subscribe((token) => {
  const httpOptions = {
    headers: new HttpHeaders({
      Authorization: 'Bearer ' + token,
    }),
  };
});
```

You can use the built in interceptor to add the accesstokens to your request

```ts
AuthModule.forRoot({
  config: {
    // ...
    secureRoutes: ['https://my-secure-url.com/', 'https://my-second-secure-url.com/'],
  },
}),
```

```ts
 providers: [
    { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
  ],
```

## Versions

Current Version is Version 21.x

- [Info about Version 20](https://github.com/damienbod/angular-auth-oidc-client/tree/version-20)
- [Info about Version 19](https://github.com/damienbod/angular-auth-oidc-client/tree/version-19)
- [Info about Version 18](https://github.com/damienbod/angular-auth-oidc-client/tree/version-18)
- [Info about Version 17](https://github.com/damienbod/angular-auth-oidc-client/tree/version-17)
- [Info about Version 16](https://github.com/damienbod/angular-auth-oidc-client/tree/version-16)
- [Info about Version 15](https://github.com/damienbod/angular-auth-oidc-client/tree/version-15)
- [Info about Version 14](https://github.com/damienbod/angular-auth-oidc-client/tree/version-14)
- [Info about Version 13](https://github.com/damienbod/angular-auth-oidc-client/tree/version-13)
- [Info about Version 12](https://github.com/damienbod/angular-auth-oidc-client/tree/version-12)
- [Info about Version 11](https://github.com/damienbod/angular-auth-oidc-client/tree/version-11)
- [Info about Version 10](https://github.com/damienbod/angular-auth-oidc-client/tree/version-10)

## License

[MIT](https://choosealicense.com/licenses/mit/)

## Authors

- [@DamienBod](https://www.github.com/damienbod)
- [@FabianGosebrink](https://www.github.com/FabianGosebrink)

---
_Source: https://npm.io/package/angular-auth-oidc-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
