{"id":13602009,"url":"https://github.com/damienbod/angular-auth-oidc-client","last_synced_at":"2025-04-23T20:49:01.732Z","repository":{"id":37733455,"uuid":"94194486","full_name":"damienbod/angular-auth-oidc-client","owner":"damienbod","description":"npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow","archived":false,"fork":false,"pushed_at":"2025-04-16T15:43:30.000Z","size":17156,"stargazers_count":1183,"open_issues_count":228,"forks_count":442,"subscribers_count":37,"default_branch":"main","last_synced_at":"2025-04-16T23:06:08.690Z","etag":null,"topics":["angular","auth","authentication","authn","identity","implicit-flow","npm","oauth2","oidc","openid","openidconnect","security"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/angular-auth-oidc-client","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damienbod.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-13T09:19:36.000Z","updated_at":"2025-04-16T15:43:35.000Z","dependencies_parsed_at":"2023-02-11T05:00:39.617Z","dependency_job_id":"72ca6e0f-8016-44e5-b962-4c1f056f98b1","html_url":"https://github.com/damienbod/angular-auth-oidc-client","commit_stats":{"total_commits":3382,"total_committers":134,"mean_commits":"25.238805970149254","dds":0.5431697220579539,"last_synced_commit":"3799a12201eb21124074338ed4c0a132234531b2"},"previous_names":[],"tags_count":169,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2Fangular-auth-oidc-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2Fangular-auth-oidc-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2Fangular-auth-oidc-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damienbod%2Fangular-auth-oidc-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damienbod","download_url":"https://codeload.github.com/damienbod/angular-auth-oidc-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250513726,"owners_count":21443204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","auth","authentication","authn","identity","implicit-flow","npm","oauth2","oidc","openid","openidconnect","security"],"created_at":"2024-08-01T18:01:11.639Z","updated_at":"2025-04-23T20:49:01.702Z","avatar_url":"https://github.com/damienbod.png","language":"TypeScript","readme":"# Angular Lib for OpenID Connect \u0026 OAuth2\n\n![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)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://angular-auth-oidc-client.com/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/damienbod/angular-auth-oidc-client/main/.github/angular-auth-logo.png\" alt=\"\" width=\"350\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nSecure your Angular app using the latest standards for OpenID Connect \u0026 OAuth2. Provides support for token refresh, all modern OIDC Identity Providers and more.\n\n## Acknowledgements\n\nThis library is \u003ca href=\"http://openid.net/certification/#RPs\"\u003ecertified\u003c/a\u003e by OpenID Foundation. (RP Implicit and Config RP)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://openid.net/certification/#RPs\"\u003e\u003cimg src=\"https://damienbod.files.wordpress.com/2017/06/oid-l-certification-mark-l-rgb-150dpi-90mm.png\" alt=\"\" width=\"400\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- [Code samples](https://angular-auth-oidc-client.com/docs/samples/) for most of the common use cases\n- Supports schematics via `ng add` support\n- Supports all modern OIDC identity providers\n- Supports OpenID Connect Code Flow with PKCE\n- Supports Code Flow PKCE with Refresh tokens\n- [Supports OpenID Connect Implicit Flow](http://openid.net/specs/openid-connect-implicit-1_0.html)\n- [Supports OpenID Connect Session Management 1.0](http://openid.net/specs/openid-connect-session-1_0.html)\n- [Supports RFC7009 - OAuth 2.0 Token Revocation](https://tools.ietf.org/html/rfc7009)\n- [Supports RFC7636 - Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636)\n- [Supports OAuth 2.0 Pushed authorisation requests (PAR) draft](https://tools.ietf.org/html/draft-ietf-oauth-par-06)\n- Semantic releases\n- Github actions\n- Modern coding guidelines with prettier, husky\n- Up to date documentation\n- Implements OIDC validation as specified, complete client side validation for REQUIRED features\n- Supports authentication using redirect or popup\n\n## Installation\n\n### Ng Add\n\nYou can use the schematics and `ng add` the library.\n\n```shell\nng add angular-auth-oidc-client\n```\n\nAnd answer the questions. A module will be created which encapsulates your configuration.\n\n![angular-auth-oidc-client schematics](https://raw.githubusercontent.com/damienbod/angular-auth-oidc-client/main/.github/angular-auth-oidc-client-schematics-720.gif)\n\n### Npm / Yarn\n\nNavigate to the level of your `package.json` and type\n\n```shell\n npm install angular-auth-oidc-client\n```\n\nor with yarn\n\n```shell\n yarn add angular-auth-oidc-client\n```\n\n## Documentation\n\n[Read the docs here](https://angular-auth-oidc-client.com/)\n\n## Samples\n\n[Explore the Samples here](https://angular-auth-oidc-client.com/docs/samples/)\n\n## Quickstart\n\nFor the example of the Code Flow. For further examples please check the [Samples](https://angular-auth-oidc-client.com/docs/samples/) Section.\n\n\u003e If you have done the installation with the schematics, these modules and files should be available already!\n\n### Configuration\n\nImport the `AuthModule` in your module.\n\n```ts\nimport { NgModule } from '@angular/core';\nimport { AuthModule, LogLevel } from 'angular-auth-oidc-client';\n// ...\n\n@NgModule({\n  // ...\n  imports: [\n    // ...\n    AuthModule.forRoot({\n      config: {\n        authority: '\u003cyour authority address here\u003e',\n        redirectUrl: window.location.origin,\n        postLogoutRedirectUri: window.location.origin,\n        clientId: '\u003cyour clientId\u003e',\n        scope: 'openid profile email offline_access',\n        responseType: 'code',\n        silentRenew: true,\n        useRefreshToken: true,\n        logLevel: LogLevel.Debug,\n      },\n    }),\n  ],\n  // ...\n})\nexport class AppModule {}\n```\n\nAnd 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.\n\n```ts\nimport { Component, OnInit, inject } from '@angular/core';\nimport { OidcSecurityService } from 'angular-auth-oidc-client';\n\n@Component({\n  /*...*/\n})\nexport class AppComponent implements OnInit {\n  private readonly oidcSecurityService = inject(OidcSecurityService);\n\n  ngOnInit() {\n    this.oidcSecurityService\n      .checkAuth()\n      .subscribe((loginResponse: LoginResponse) =\u003e {\n        const { isAuthenticated, userData, accessToken, idToken, configId } =\n          loginResponse;\n\n        /*...*/\n      });\n  }\n\n  login() {\n    this.oidcSecurityService.authorize();\n  }\n\n  logout() {\n    this.oidcSecurityService\n      .logoff()\n      .subscribe((result) =\u003e console.log(result));\n  }\n}\n```\n\n### Using the access token\n\nYou can get the access token by calling the method `getAccessToken()` on the `OidcSecurityService`\n\n```ts\nconst token = this.oidcSecurityService.getAccessToken().subscribe(...);\n```\n\nAnd then you can use it in the HttpHeaders\n\n```ts\nimport { HttpHeaders } from '@angular/common/http';\n\nconst token = this.oidcSecurityServices.getAccessToken().subscribe((token) =\u003e {\n  const httpOptions = {\n    headers: new HttpHeaders({\n      Authorization: 'Bearer ' + token,\n    }),\n  };\n});\n```\n\nYou can use the built in interceptor to add the accesstokens to your request\n\n```ts\nAuthModule.forRoot({\n  config: {\n    // ...\n    secureRoutes: ['https://my-secure-url.com/', 'https://my-second-secure-url.com/'],\n  },\n}),\n```\n\n```ts\n providers: [\n    { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },\n  ],\n```\n\n## Versions\n\nCurrent Version is Version 19.x\n\n- [Info about Version 18](https://github.com/damienbod/angular-auth-oidc-client/tree/version-18)\n- [Info about Version 17](https://github.com/damienbod/angular-auth-oidc-client/tree/version-17)\n- [Info about Version 16](https://github.com/damienbod/angular-auth-oidc-client/tree/version-16)\n- [Info about Version 15](https://github.com/damienbod/angular-auth-oidc-client/tree/version-15)\n- [Info about Version 14](https://github.com/damienbod/angular-auth-oidc-client/tree/version-14)\n- [Info about Version 13](https://github.com/damienbod/angular-auth-oidc-client/tree/version-13)\n- [Info about Version 12](https://github.com/damienbod/angular-auth-oidc-client/tree/version-12)\n- [Info about Version 11](https://github.com/damienbod/angular-auth-oidc-client/tree/version-11)\n- [Info about Version 10](https://github.com/damienbod/angular-auth-oidc-client/tree/version-10)\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n## Authors\n\n- [@DamienBod](https://www.github.com/damienbod)\n- [@FabianGosebrink](https://www.github.com/FabianGosebrink)\n","funding_links":[],"categories":["Relying Parties (RP) Libraries","angular","Security and Authentication"],"sub_categories":["JavaScript","Authentication"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamienbod%2Fangular-auth-oidc-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamienbod%2Fangular-auth-oidc-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamienbod%2Fangular-auth-oidc-client/lists"}